[dpdk-dev] devtools: make commits with stable tag outstanding

Message ID 1487818172-12910-1-git-send-email-yuanhan.liu@linux.intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Yuanhan Liu Feb. 23, 2017, 2:49 a.m. UTC
  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.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 devtools/git-log-fixes.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Thomas Monjalon March 10, 2017, 11:13 a.m. UTC | #1
2017-02-23 10:49, 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.

Good idea 

> +	stable="-"
> +	git show $id | grep -qi 'Cc: .*stable@dpdk.org' && 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: *stable@dpdk.org'

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: *stable@dpdk.org' && stable='S' || stable='-'

2/
if git log --format='%b' -1 $id | grep -qi '^Cc: *stable@dpdk.org' ; 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: *stable@dpdk.org' ; then
		echo 'S'
	else
		echo '-'
	endif
}
  
Yuanhan Liu April 6, 2017, 6:31 a.m. UTC | #2
On Fri, Mar 10, 2017 at 12:13:28PM +0100, Thomas Monjalon wrote:
> 2017-02-23 10:49, 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.
> 
> Good idea 
> 
> > +	stable="-"
> > +	git show $id | grep -qi 'Cc: .*stable@dpdk.org' && 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: *stable@dpdk.org'
> 
> 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: *stable@dpdk.org' && stable='S' || stable='-'
> 
> 2/
> if git log --format='%b' -1 $id | grep -qi '^Cc: *stable@dpdk.org' ; 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)

Looks good. Will send v2 soon.

Thanks.

	--yliu
> 
> # print a marker for stable tag presence
> stable_tag () # <hash>
> {
> 	if git log --format='%b' -1 $id | grep -qi '^Cc: *stable@dpdk.org' ; then
> 		echo 'S'
> 	else
> 		echo '-'
> 	endif
> }
  

Patch

diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
index d590735..af489a5 100755
--- a/devtools/git-log-fixes.sh
+++ b/devtools/git-log-fixes.sh
@@ -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: .*stable@dpdk.org' && stable="S"
+	printf '%s %7s %s %s (%s)\n' $version $id $stable "$headline" "$origver"
 done