2 # TopGit - A different patch queue manager
3 # (c) Petr Baudis <pasky@suse.cz> 2008
4 # (c) Per Cederqvist <ceder@lysator.liu.se> 2010
7 force
= # Whether to annihilate non-empty branch, or branch where only the base is left.
18 echo "Usage: ${tgname:-tg} [...] annihilate [-f]" >&2
26 name
="$(verify_topgit_branch HEAD)"
28 [ -z "$force" ] && { branch_empty
"$name" || die
"branch is non-empty: $name"; }
31 ensure_ident_available
32 mb
="$(git merge-base "refs
/$topbases/$name" "refs
/heads
/$name")"
33 git read-tree
"$mb^{tree}"
34 # Need to pass --no-verify in order to inhibit TopGit's pre-commit hook to run,
35 # which would bark upon missing .top* files.
36 git commit
--no-verify -m"TopGit branch $name annihilated."
38 # Propagate the dependencies through to dependents (if any), if they don't already have them
39 dependencies
="$(tg prev -w)"
41 while read dependent
&& [ -n "$dependent" ]; do
42 git checkout
-f "refs/heads/$dependent"
44 while read dependency
&& [ -n "$dependency" ]; do
45 ! $tg depend add
--no-update "$dependency" >/dev
/null
2>&1 || needupdate
=1
49 [ -z "$needupdate" ] || updatelist
="${updatelist:+$updatelist }$dependent"
54 info
"branch successfully annihilated: $name"
55 if [ -n "$updatelist" ]; then
56 info
"now updating affected branches: $updatelist"
57 while read dependent
&& [ -n "$dependent" ]; do
58 $tg update
"$dependent"
60 $(sed 'y/ /\n/' <<-LIST
67 info
"If you have shared your work, you might want to run ${tgname:-tg} push $name now."