What's cooking (2013/04 #03)
[git.git] / RB
blobc557b06971ffa981f6117e4d08ad53de9d87d523
1 #!/bin/sh
3 master_sha1=`git rev-parse --verify refs/heads/master`
4 LF='
6 (cd .git/refs/heads && find -type f) |
7 sed -n \
8 -e 's/^\.\///' \
9 -e '/^[^\/][^\/]\//p' |
10 while read topic
12 case " $* " in
13 *' '"$topic"' '*)
14 echo >&2 "* Skipping $topic"
15 continue ;;
16 esac
18 rebase= done= not_done= trouble= date=
19 topic_sha1=`git rev-parse --verify "refs/heads/$topic"`
21 date=`
22 git rev-list -1 --pretty "$topic" |
23 sed -ne 's/^Date: *\(.*\)/ (\1)/p'
25 only_next_1=`git rev-list ^master "^$topic" next | sort`
26 only_next_2=`git rev-list ^master next | sort`
27 rebase=
28 if test "$only_next_1" = "$only_next_2"
29 then
30 not_in_topic=`git rev-list "^$topic" master`
31 if test -z "$not_in_topic"
32 then
33 :; # already up-to-date.
34 else
35 rebase=" (can be rebased)"
38 if test -n "$rebase"
39 then
40 echo "Rebasing $topic to pick up:"
41 git rev-list --pretty=oneline "^$topic" master |
42 sed -e 's/^[0-9a-f]* / * /'
43 git checkout "$topic" &&
44 git rebase master || break;
46 done