]> git.ipfire.org Git - thirdparty/git.git/commitdiff
GRADUATED: compare with older maintenance series as well
authorJunio C Hamano <gitster@pobox.com>
Wed, 18 Mar 2009 05:28:38 +0000 (22:28 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 18 Mar 2009 05:28:38 +0000 (22:28 -0700)
GRADUATED

index 01ee411a3f0aebcf3a0519d16085ac6b97dcb733..c6a427fb483b73c778270618c506593bbac0bd52 100755 (executable)
--- a/GRADUATED
+++ b/GRADUATED
@@ -1,5 +1,8 @@
 #!/bin/sh
 
+# Older first!
+old_maint='maint-1.6.0 maint-1.6.1'
+
 _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
 _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
 LF='
@@ -25,16 +28,29 @@ tmp=/tmp/GR.$$
 
 trap 'rm -f "$tmp".*' 0
 
-git branch --merged master | sed -n -e '/\//s/^. //p' >"$tmp.master"
-git branch --merged maint | sed -n -e '/\//s/^. //p' >"$tmp.maint"
+git branch --merged master | sed -n -e '/\//s/^. //p' | sort >"$tmp.master"
 
-comm -12 "$tmp.maint" "$tmp.master" >"$tmp.both"
-if test -s "$tmp.both"
-then
-       echo "# Graduated to both maint and master"
-       sed -e 's|^|git branch -d |' "$tmp.both"
-       echo
-fi
+>"$tmp.known"
+for m in $old_maint maint
+do
+       git branch --merged $m | sed -n -e '/\//s/^. //p' | sort >"$tmp.$m"
+       comm -12 "$tmp.$m" "$tmp.master" >"$tmp.both0"
+       comm -23 "$tmp.both0" "$tmp.known" >"$tmp.both"
+       if test -s "$tmp.both"
+       then
+               echo "# Graduated to both $m and master"
+               while read branch
+               do
+                       echo "$(git show -s --format='%ct' "$branch") $branch"
+               done <"$tmp.both" |
+               sort -r -n |
+               sed -e 's/^[0-9]* //' \
+                   -e 's/^/git branch -d /'
+               echo
+               cat "$tmp.known" "$tmp.both" | sort >"$tmp.next"
+               mv "$tmp.next" "$tmp.known"
+       fi
+done
 
 comm -13 "$tmp.maint" "$tmp.master" |
 {