aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSasha Levin <sasha.levin@oracle.com>2015-10-31 20:42:29 -0400
committerSasha Levin <sasha.levin@oracle.com>2015-10-31 20:42:29 -0400
commit676416b4009ce77b73806663216814d13dcad327 (patch)
treef290ba39cd18429ffd9631f251b486e6edbefb4f
parent65fa9bf1be1ab3bb1e51637fbae8f2cefe4265a3 (diff)
downloadstable-tools-676416b4009ce77b73806663216814d13dcad327.tar.gz
find-alts
Find alternative commits in other stable branches. Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
-rw-r--r--README8
-rwxr-xr-xstable-find-alts21
2 files changed, 29 insertions, 0 deletions
diff --git a/README b/README
index caeae44..032e552 100644
--- a/README
+++ b/README
@@ -34,3 +34,11 @@ grepping for a subject line might instead point to a different commit that
only contains the subject line of the commit we're looking for in it's own
commit message. In that case, we must do a more expensive search and evaluate
all commits containing the given subject line.
+
+
+2) stable find-alts <commit sha1>
+
+Provides a list of commits with the same subject line in other stable branches.
+
+An example use case is to compare backport of a patch with the way other
+maintainers have done it.
diff --git a/stable-find-alts b/stable-find-alts
new file mode 100755
index 0000000..3791d1a
--- /dev/null
+++ b/stable-find-alts
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# Show all commits with same subject line in the repository.
+#
+
+if [ "$#" -ne 1 ]; then
+ echo "Usage: stable find-alts <commit sha1>"
+ exit 1
+fi
+
+subj=$(git log -1 --pretty="%s" $1)
+if [ $? -gt 0 ]; then
+ exit 1
+fi
+
+for i in $(git log -F --grep "$subj" --format="%H" $OTHER_STABLE_TREES); do
+ cursubj=$(git log -1 --format="%s" $i)
+ if [ "$subj" = "$cursubj" ]; then
+ echo $i
+ fi
+done