From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: dev@dpdk.org
Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Subject: [dpdk-dev] [PATCH] scripts: show fixes with release version of bug
Date: Thu, 29 Sep 2016 11:41:50 +0200 [thread overview]
Message-ID: <1475142110-8294-1-git-send-email-thomas.monjalon@6wind.com> (raw)
This script can help to find commits to backport in stable branches.
Fixes are found if there is the word "fix" in the headline or
if there is a tag Fixes: or Reverts: in the message.
Chained fixes of fixes are explored to find the oldest origin.
Fixes of not released bugs are ignored.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
scripts/git-log-fixes.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)
create mode 100755 scripts/git-log-fixes.sh
diff --git a/scripts/git-log-fixes.sh b/scripts/git-log-fixes.sh
new file mode 100755
index 0000000..cb7ed2e
--- /dev/null
+++ b/scripts/git-log-fixes.sh
@@ -0,0 +1,63 @@
+#! /bin/sh -e
+
+if [ $# -lt 1 ] ; then
+ echo 'range argument required' >&2
+ exit 1
+fi
+range="$*"
+
+# get major release version of a commit
+commit_version () # <hash>
+{
+ tag=$(git tag -l --contains $1 | head -n1)
+ if [ -z "$tag" ] ; then
+ # before -rc1 tag of release in progress
+ make showversion | cut -d'.' -f-2
+ else
+ echo $tag | sed 's,^v,,' | sed 's,-rc.*,,'
+ fi
+}
+
+# get bug origin hashes of a fix
+origin_filter () # <hash>
+{
+ git log --format='%b' -1 $1 |
+ sed -n 's,^ *\([Ff]ixes\|[Rr]everts\): *\([0-9a-f]*\).*,\2,p'
+}
+
+# get oldest major release version of bug origins
+origin_version () # <origin_hash> ...
+{
+ for origin in $* ; do
+ # check hash is valid
+ git rev-parse -q --verify $1 >&- || continue
+ # get version of this bug origin
+ local origver=$(commit_version $origin)
+ local roothashes=$(origin_filter $origin)
+ if [ -n "$roothashes" ] ; then
+ # look chained fix of fix recursively
+ local rootver="$(origin_version $roothashes)"
+ [ -n "$rootver" ] || continue
+ echo "$rootver (partially fixed in $origver)"
+ else
+ echo "$origver"
+ fi
+ # filter the oldest origin
+ done | sort -uV | head -n1
+}
+
+git log --oneline --reverse $range |
+while read id headline ; do
+ origins=$(origin_filter $id)
+ [ -n "$origins" ] || echo "$headline" | grep -q fix || continue
+ version=$(commit_version $id)
+ if [ -n "$origins" ] ; then
+ origver="$(origin_version $origins)"
+ [ -n "$origver" ] || continue
+ # ignore fix of bug introduced in the same release
+ ! echo "$origver" | grep -q "^$version" || continue
+ else
+ origver='N/A'
+ fi
+ printf '%s %7s %s (%s)\n' $version $id "$headline" "$origver"
+done
--
2.7.0
next reply other threads:[~2016-09-29 9:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-29 9:41 Thomas Monjalon [this message]
2016-09-30 14:18 ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
2016-11-04 6:58 ` Yuanhan Liu
2016-11-05 14:49 ` 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=1475142110-8294-1-git-send-email-thomas.monjalon@6wind.com \
--to=thomas.monjalon@6wind.com \
--cc=dev@dpdk.org \
--cc=yuanhan.liu@linux.intel.com \
/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).