2 # TopGit - A different patch queue manager
3 # (c) Petr Baudis <pasky@suse.cz> 2008
4 # (c) Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> 2008
17 branch_prefix
="$1"; shift;;
19 echo "Usage: tg [...] import [-p PREFIX] RANGE..." >&2
22 ranges
="$ranges $arg";;
30 git log
-1 --pretty=format
:"From: %an <%ae>%n%n%s%n%n%b" "$commit"
35 # nice sed script from git-format-patch.sh
46 git log
-1 --pretty=format
:"%s" "$commit" |
sed -e "$titleScript"
52 branch_name
=$
(get_branch_name
"$commit")
53 info
"---- Importing $commit to $branch_prefix$branch_name"
54 tg create
"$branch_prefix""$branch_name"
55 git read-tree
"$commit"
56 get_commit_msg
"$commit" > .topmsg
57 git add
-f .topmsg .topdeps
58 git commit
-C "$commit"
59 info
"++++ Importing $commit finished"
62 # nice arg verification stolen from git-format-patch.sh
63 for revpair
in $ranges
67 rev1
=`expr "z$revpair" : 'z\(.*\)\.\.'`
68 rev2
=`expr "z$revpair" : 'z.*\.\.\(.*\)'`
71 die
"Unknow range spec $revpair"
74 git rev-parse
--verify "$rev1^0" >/dev
/null
2>&1 ||
75 die
"Not a valid rev $rev1 ($revpair)"
76 git rev-parse
--verify "$rev2^0" >/dev
/null
2>&1 ||
77 die
"Not a valid rev $rev2 ($revpair)"
78 git cherry
-v "$rev1" "$rev2" |
79 while read sign
rev comment
83 info
"Merged already: $comment"