DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Subject: [PATCH 2/2] devtools: deduplicate function to mark fixes
Date: Tue, 18 Apr 2023 16:07:26 +0200	[thread overview]
Message-ID: <20230418140726.1472209-3-thomas@monjalon.net> (raw)
In-Reply-To: <20230418140726.1472209-1-thomas@monjalon.net>

In the commit 8070d8fecb4e ("devtools: add fixes flag to commit listing")
the function to mark a commit for "stable" was duplicated for "Fixes:" mark.

The code is a bit smaller by using a single function for both marks.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 devtools/git-log-fixes.sh | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
index 4690dd4545..005e46f715 100755
--- a/devtools/git-log-fixes.sh
+++ b/devtools/git-log-fixes.sh
@@ -84,31 +84,21 @@ origin_version () # <origin_hash> ...
 	done | sort -uV | head -n1
 }
 
-# print a marker for stable tag presence
-stable_tag () # <hash>
+# print a marker for pattern presence in the commit message
+git_log_mark () # <hash> <pattern> <marker>
 {
-	if git log --format='%b' -1 $1 | grep -qi '^Cc: *stable@dpdk.org' ; then
-		echo 'S'
+	if git log --format='%b' -1 $1 | grep -qi "$2" ; then
+		echo "$3"
 	else
 		echo '-'
 	fi
 }
 
-# print a marker for fixes tag presence
-fixes_tag () # <hash>
-{
-        if git log --format='%b' -1 $1 | grep -qi '^Fixes: *' ; then
-                echo 'F'
-        else
-                echo '-'
-        fi
-}
-
 git log --oneline --reverse $range |
 while read id headline ; do
 	origins=$(origin_filter $id)
-	stable=$(stable_tag $id)
-	fixes=$(fixes_tag $id)
+	stable=$(git_log_mark $id '^Cc: *stable@dpdk.org' 'S')
+	fixes=$(git_log_mark $id '^Fixes:' 'F')
 	[ "$stable" = "S" ] || [ "$fixes" = "F" ] || [ -n "$origins" ] || continue
 	version=$(commit_version $id)
 	if [ -n "$origins" ] ; then
-- 
2.40.0


  parent reply	other threads:[~2023-04-18 14:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18 14:07 [PATCH 0/2] minor changes in script used for backports Thomas Monjalon
2023-04-18 14:07 ` [PATCH 1/2] devtools: fix check of multiple commits fixed at once Thomas Monjalon
2023-11-28 14:15   ` Luca Boccassi
2023-04-18 14:07 ` Thomas Monjalon [this message]
2023-11-28 14:14   ` [PATCH 2/2] devtools: deduplicate function to mark fixes Luca Boccassi
2023-11-28 13:23 ` [PATCH 0/2] minor changes in script used for backports Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230418140726.1472209-3-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).