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
16 echo "Usage: tg [...] import RANGE..." >&2
19 ranges="$ranges $arg";;
27 git log -1 --pretty=format:"From: %an <%ae>%n%n%s%n%n%b" "$commit"
32 # nice sed script from git-format-patch.sh
43 git log -1 --pretty=format:"%s" "$commit" | sed -e "$titleScript"
49 branch_name=$(get_branch_name "$commit")
50 echo "Importing $commit to $branch_name"
51 tg create t/"$branch_name"
52 git read-tree "$commit"
53 get_commit_msg "$commit" > .topmsg
54 git add -f .topmsg .topdeps
55 git commit -C "$commit"
58 # nice arg verification stolen from git-format-patch.sh
59 for revpair in $ranges
63 rev1=`expr "z$revpair" : 'z\(.*\)\.\.'`
64 rev2=`expr "z$revpair" : 'z.*\.\.\(.*\)'`
67 die "Unknow range spec $revpair"
70 git rev-parse --verify "$rev1^0" >/dev/null 2>&1 ||
71 die "Not a valid rev $rev1 ($revpair)"
72 git rev-parse --verify "$rev2^0" >/dev/null 2>&1 ||
73 die "Not a valid rev $rev2 ($revpair)"
74 git cherry -v "$rev1" "$rev2" |
75 while read sign rev comment
79 info "Merged already: $comment"