Skip to contentSkip to conversation

devtools: make commits with stable tag outstanding

PATCH Superseded Yuanhan Liu 2 participants 5 messages Feb 23, 2017 – Apr 6, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtools: make commits with stable tag outstanding

So that, as a stable maintainer while picking commits to a stable release, I could pay less attention to those have it and pay more attention to those don't have it.

---
 devtools/git-log-fixes.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
devtools/git-log-fixes.sh +3 -1
index d590735..af489a5 100755
@@ -116,5 +116,7 @@ while read id headline ; do
 	else
 		origver='N/A'
 	fi
-	printf '%s %7s %s (%s)\n' $version $id "$headline" "$origver"
+	stable="-"
+	git show $id | grep -qi 'Cc: .*[email protected]' && stable="S"
+	printf '%s %7s %s %s (%s)\n' $version $id $stable "$headline" "$origver"
 done
Signature · 1 line
1.9.0
#1 lore raw

2017-02-23 10:49, Yuanhan Liu:

Quoted 3 lines

So that, as a stable maintainer while picking commits to a stable release, I could pay less attention to those have it and pay more attention to those don't have it.

Good idea

devtools/git-log-fixes.sh while read id headline ; do · line 120

Quoted 2 lines
devtools/git-log-fixes.sh +2 -0
+	stable="-"
+	git show $id | grep -qi 'Cc: .*[email protected]' && stable="S"

Instead of git show, it is preferrable to get only the message content:

	git log --format='%b' -1 $id

The regex may miss a Cc: without space, and may match a Cc in the middle of a sentence.
I suggest this one:
grep -qi '^Cc: *[email protected]'

The script is written in the style "set -e" so it must be avoided to have a "false" statement not catched.
It can be done in 2 ways:

1/
git log --format='%b' -1 $id | grep -qi '^Cc: *[email protected]' && stable='S' || stable='-'

2/
if git log --format='%b' -1 $id | grep -qi '^Cc: *[email protected]' ; then

	stable='S'
else
	stable='-'

endif

We can also move it in a function in order to keep only the logic in the "main" block:

	stable=$(stable_tag $id)
# print a marker for stable tag presence
stable_tag () # <hash>
{
	if git log --format='%b' -1 $id | grep -qi '^Cc: *[email protected]' ; then
		echo 'S'
	else
		echo '-'
	endif
}
#2 lore raw
Quoted 27 lines · Thomas Monjalon

2017-02-23 10:49, Yuanhan Liu:

Quoted 3 lines

So that, as a stable maintainer while picking commits to a stable release, I could pay less attention to those have it and pay more attention to those don't have it.

Good idea

devtools/git-log-fixes.sh while read id headline ; do · line 120

Quoted 2 lines
devtools/git-log-fixes.sh +2 -0
+	stable="-"
+	git show $id | grep -qi 'Cc: .*[email protected]' && stable="S"

Instead of git show, it is preferrable to get only the message content:

	git log --format='%b' -1 $id

The regex may miss a Cc: without space, and may match a Cc in the middle of a sentence.
I suggest this one:
grep -qi '^Cc: *[email protected]'

The script is written in the style "set -e" so it must be avoided to have a "false" statement not catched.
It can be done in 2 ways:

1/
git log --format='%b' -1 $id | grep -qi '^Cc: *[email protected]' && stable='S' || stable='-'

2/
if git log --format='%b' -1 $id | grep -qi '^Cc: *[email protected]' ; then

Quoted 8 lines
	stable='S'
else
	stable='-'

endif

We can also move it in a function in order to keep only the logic in the "main" block:

	stable=$(stable_tag $id)

Looks good. Will send v2 soon.

Thanks.

	--yliu
Quoted 10 lines
# print a marker for stable tag presence
stable_tag () # <hash>
{
	if git log --format='%b' -1 $id | grep -qi '^Cc: *[email protected]' ; then
		echo 'S'
	else
		echo '-'
	endif
}
#3 lore raw

PATCH v2 1/1 devtools: make commits with stable tag outstanding

In reply to Yuanhan Liu

So that, as a stable maintainer while picking commits to a stable release, I could pay less attention to those have it and pay more attention to those don't have it.

---

v2: - introduce a function stable_tag for that
- fix regexp

---
 devtools/git-log-fixes.sh | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
devtools/git-log-fixes.sh +12 -1
index d590735..359fbda 100755
@@ -103,6 +103,16 @@ origin_version () # <origin_hash> ...
 	done | sort -uV | head -n1
 }
 
+# print a marker for stable tag presense
+stable_tag () # <hash>
+{
+	if git log --format='%b' -1 $1 | grep -qi '^Cc: *[email protected]' ; then
+		echo 'S'
+	else
+		echo '-'
+	fi
+}
+
 git log --oneline --reverse $range |
 while read id headline ; do
 	origins=$(origin_filter $id)
@@ -116,5 +126,6 @@ while read id headline ; do
 	else
 		origver='N/A'
 	fi
-	printf '%s %7s %s (%s)\n' $version $id "$headline" "$origver"
+	stable=$(stable_tag $id)
+	printf '%s %7s %s %s (%s)\n' $version $id $stable "$headline" "$origver"
 done
Signature · 1 line
1.9.0