3 _x40
='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
4 _x40
="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
13 topic
="$(git rev-parse --verify "$1")" integrate
="$2"
14 git rev-list
--first-parent --parents "$2" |
16 /^$_x40 $_x40 $topic$/{
17 s/^\($_x40\) $_x40 $topic$/\1/p
26 trap 'rm -f "$tmp".*' 0
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 comm -12 "$tmp.maint" "$tmp.master" >"$tmp.both"
32 if test -s "$tmp.both"
34 echo "# Graduated to both maint and master"
35 sed -e 's|^|git branch -d |' "$tmp.both"
39 comm -13 "$tmp.maint" "$tmp.master" |
43 t
=$
(find_last_tip
$topic master
) &&
45 m
=$
(git rev-parse
--verify "$t^1") &&
46 test -n "$m" ||
continue
48 # NEEDSWORK: this misses repeated merges
54 # ---o---o---*---*---master
56 tsize
=$
(git rev-list
"$m..$topic" |
wc -l)
57 rsize
=$
(git rev-list
"maint..$topic" |
wc -l)
59 if test $tsize -eq $rsize
61 s
=$
(git show
-s --pretty="tformat:%ct %H" $t)
64 s
=$
(git show
-s --pretty="tformat:%ct %H" $t)
67 done 3>"$tmp.unmergeable" >"$tmp.mergeable"
69 if test -s "$tmp.unmergeable"
71 echo "# Graduated to master; unmergeable to maint"
72 sort -n "$tmp.unmergeable" |
73 while read timestamp merge topic
75 git show
-s --pretty="format:# %h %cd" $merge
76 echo "git branch -d $topic"
80 if test -s "$tmp.mergeable"
82 sort -n "$tmp.mergeable" |
83 while read timestamp merge topic
86 git show
-s --pretty="format:%h %cd" $merge
87 git log
--pretty=oneline
--abbrev-commit maint..
$topic
90 echo "git checkout maint && git merge $topic"