GRADUATED: compare with older maintenance series as well
Junio C Hamano committed
Mar 17, 2009 at 22:28 UTC
cc067fafd4d370d07e584abff5c2d79a284b2afa
1 file changed
+25
-9
GRADUATED
+25
-9
@@ -1,5 +1,8 @@
1
#!/bin/sh
2
3
+# Older first!
4
+old_maint='maint-1.6.0 maint-1.6.1'
5
+
6
_x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
7
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
8
LF='
@@ -25,16 +28,29 @@ tmp=/tmp/GR.$$
28
29
trap 'rm -f "$tmp".*' 0
30
28
-git branch --merged master | sed -n -e '/\//s/^. //p' >"$tmp.master"
29
-git branch --merged maint | sed -n -e '/\//s/^. //p' >"$tmp.maint"
31
+git branch --merged master | sed -n -e '/\//s/^. //p' | sort >"$tmp.master"
32
31
-comm -12 "$tmp.maint" "$tmp.master" >"$tmp.both"
32
-if test -s "$tmp.both"
33
-then
34
- echo "# Graduated to both maint and master"
35
- sed -e 's|^|git branch -d |' "$tmp.both"
36
- echo
37
-fi
33
+>"$tmp.known"
34
+for m in $old_maint maint
35
+do
36
+ git branch --merged $m | sed -n -e '/\//s/^. //p' | sort >"$tmp.$m"
37
+ comm -12 "$tmp.$m" "$tmp.master" >"$tmp.both0"
38
+ comm -23 "$tmp.both0" "$tmp.known" >"$tmp.both"
39
+ if test -s "$tmp.both"
40
+ then
41
+ echo "# Graduated to both $m and master"
42
+ while read branch
43
+ do
44
+ echo "$(git show -s --format='%ct' "$branch") $branch"
45
+ done <"$tmp.both" |
46
+ sort -r -n |
47
+ sed -e 's/^[0-9]* //' \
48
+ -e 's/^/git branch -d /'
49
+ echo
50
+ cat "$tmp.known" "$tmp.both" | sort >"$tmp.next"
51
+ mv "$tmp.next" "$tmp.known"
52
+ fi
53
+done
54
55
comm -13 "$tmp.maint" "$tmp.master" |
56
{