2 # TopGit - A different patch queue manager
24 tgish_deps_only
=true
;;
28 echo "Usage: ${tgname:-tg} [...] push [--dry-run] [--force] [--no-deps] [--tgish-only] [-r <remote>] [-a | --all | <branch>...]"
35 branches
="${branches:+$branches }$(strip_ref "$arg")";;
39 if [ -z "$remote" ]; then
43 if [ -z "$remote" ]; then
44 die
"no remote location given. Either use -r remote argument or set topgit.remote"
47 if [ -z "$branches" ]; then
49 branches
="$(non_annihilated_branches | paste -s -d " ")"
51 branches
="$(verify_topgit_branch HEAD)"
54 oldbranches
="$branches"
56 while read name
&& [ -n "$name" ]; do
57 if [ "$name" = "HEAD" ]; then
58 sr
="$(git symbolic-ref --quiet HEAD)" ||
:
59 [ -n "$sr" ] || die
"cannot push a detached HEAD"
60 case "$sr" in refs
/heads
/*);;*)
61 die
"HEAD is a symref to other than refs/heads/..."
63 branches
="${branches:+$branches }${sr#refs/heads/}"
65 ref_exists
"refs/heads/$name" || die
"no such ref: refs/heads/$name"
66 branches
="${branches:+$branches }$name"
69 $(sed 'y/ /\n/' <<-LIST
77 _listfile
="$(get_temp tg-push-listfile)"
81 # FIXME should we abort on missing dependency?
82 [ -z "$_dep_missing" ] ||
return 0
84 # if so desired omit non tgish deps
85 $tgish_deps_only && [ -z "$_dep_is_tgish" ] && return 0
87 # filter out plain SHA1s. These don't need to be pushed explicitly as
88 # the patches that depend on the sha1 have it already in their ancestry.
89 is_sha1
"$_dep" && return 0
91 echol
"$_dep" >> "$_listfile"
92 [ -z "$_dep_is_tgish" ] ||
93 echo "$topbases/$_dep" >> "$_listfile"
97 while read name
&& [ -n "$name" ]; do
99 # re-use push_branch, which expects some pre-defined variables
103 ref_exists
"refs/$topbases/$_dep" ||
107 # deps but only if branch is tgish
108 $recurse_deps && [ -n "$_dep_is_tgish" ] &&
109 recurse_deps push_branch
"$name"
111 $(sed 'y/ /\n/' <<LIST
117 # remove multiple occurrences of the same branch
118 sort -u "$_listfile" |
xargs git push
$dry_run $force "$remote"