git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] topgit tg push feature

From
Bert Wesarg <bert.wesarg@googlemail.com>
Date
May 7, 2009, 05:45 UTC
Message-ID
<36ca99e90905062245w1ec78828ice5ed18161b6ec43@mail.gmail.com>
In-Reply-To
<20090507045904.GA2068@gmx.de>
On Thu, May 7, 2009 at 06:59, Marc Weber <marco-oweber@gmx.de> wrote:
> Uwe K,
>
> what do you think. Is there still much to change to include this patch into
> upstream?
I think its a usefull tool, but I haven't tested it yet.
Show 29 quoted lines
>
> new patch version. adding small comment saying that the two options
> --ne-deps and --tgish-only will seldomly used..
>
> Sincerly
> Marc Weber
>
> commit c1cff518e3f70e9bd6cb4f2119b86e506ab43776
> Author: Marc Weber <marco-oweber@gmx.de>
> Date:   Thu May 7 06:46:28 2009 +0200
>
>    t/tg-push
>
>    add tg-push  pushing the branch, its deps and their bases
>
>    Usage: tg push [(--no-deps | --tgish-only)] remote*
>
>    Signed-off-by: Marc Weber <marco-oweber@gmx.de>
>
> diff --git a/README b/README
> index d2f095d..6f2b2bc 100644
> --- a/README
> +++ b/README
> @@ -480,6 +480,19 @@ tg update
>
>        TODO: tg update -a for updating all topic branches
>
> +tg push
> +       Usage: tg push [(--no-deps | --tgish-only)] remote*

no need to repeat yourself. 'tg help push' will print the usage from tg-push first. And where is the --dry-run option?

Show 8 quoted lines
> +
> +       $git push remote branch # this doesn't push the base.
> +       $git push remote        # pushes all branches (and bases)
> +       You use
> +
> +       $tg push remote
> +       to push the current branch,
> its deps and their both tgish and non-tgish deps.

This phrase needs rewording, what about: "its deps, both their tgish and non-tgish ones."

> You may add --no-deps and or --tgish-only
> +       to change this default behaviour. Probably youn never want
> +       to do this
I think a "use these only if you know what you are doing" is better.
Show 34 quoted lines
> +
>  TODO: tg rename
>
>
> diff --git a/tg-push.sh b/tg-push.sh
> new file mode 100644
> index 0000000..49124e6
> --- /dev/null
> +++ b/tg-push.sh
> @@ -0,0 +1,69 @@
> +#!/bin/sh
> +# TopGit - A different patch queue manager
> +# GPLv2
> +
> +remotes=
> +
> +## Parse options see README
> +
> +recurse_deps=1
> +tgish_deps_only=
> +
> +while [ -n "$1" ]; do
> +       arg="$1"; shift
> +       case "$arg" in
> +       --no-deps)
> +               recurse_deps=;;
> +       --dry-run)
> +               dry_run=1;;
> +       --tgish-only)
> +               tgish_deps_only=1;;
> +       *)
> +               remotes="$remotes $arg";;
> +       esac
> +done

now i see why you have the Usage: in the README. common practice is to print the usage if an unknown option was given. see all the other tg-*.sh scripts.

> +
> +if [ -z "$remotes" ]; then
> +       remotes="$(git config topgit.remote 2>/dev/null)"
> +fi

How effetcts the tg -r REMOTE option this command. Or more exactly why doesn't have this option an effect here?

Show 7 quoted lines
> +
> +if [ -z "$remotes" ]; then
> +       die "no remote location given. Either add a remote as additional argument or set topgit.remote"
> +fi
> +
> +name="$(git symbolic-ref HEAD | sed 's#^refs/heads/##')"
> +ref_exists "$name" || die "detached HEAD? Can't push that"
the common error message is: "not a TopGit-controlled branch".
Show 33 quoted lines
> +
> +push_branch(){
> +       # don't push remotes
> +       [ -z "${_dep##refs/remotes/*}" ] && return 0
> +       # if so desired omit non tgish deps
> +       [ -z "$tgish_deps_only" ] || [ -n "$_dep_is_tgish" ] || return 0
> +
> +       echo "$_dep"
> +       local base="top-bases/$_dep"
> +       if ref_exists "$base"; then
> +               echo "top-bases/$_dep"
> +       else
> +               echo "warning, no base found $base" 1>&2
> +       fi
> +}
> +
> +for remote in $remotes; do
> +       list="$(
> +               # deps
> +               if [ -n "$recurse_deps" ]; then
> +                       recurse_deps push_branch "$name"
> +               fi
> +               # current branch
> +               _dep="$name"
> +               _dep_is_tgish=1
> +               push_branch "$name"
> +       )"
> +       echo "pushing:"; echo $list
> +       if [ -n "$dry_run" ]; then
> +               echo git push $remote $list
> +       else
> +               git push $remote $list
> +       fi
why not pass the --dry-run option to git remote?
> +done
Bert
Previous: Marc WeberNext: Uwe Kleine-König
Message 5 of 22 in “topgit tg push feature”
  1. topgit tg push featureMarc Weber, Apr 25, 2009
  2. Marc WeberApr 25, 2009
  3. Marc WeberMay 5, 2009
  4. Marc WeberMay 7, 2009
  5. Bert WesargMay 7, 2009
  6. Uwe Kleine-KönigMay 7, 2009
  7. Bert WesargMay 7, 2009
  8. martin f krafftMay 9, 2009
  9. Marc WeberMay 9, 2009
  10. Marc WeberMay 11, 2009
  11. martin f krafftMay 11, 2009
  12. martin f krafftMay 11, 2009
  13. Uwe Kleine-KönigMay 11, 2009
  14. Marc WeberMay 11, 2009
  15. martin f krafftMay 11, 2009
  16. Uwe Kleine-KönigMay 12, 2009
  17. Bert WesargMay 12, 2009
  18. Marc WeberMay 12, 2009
  19. Bert WesargMay 12, 2009
  20. Uwe Kleine-KönigMay 12, 2009
  21. tg-remote: don't add push specs but warn about existing ones.Uwe Kleine-König, May 13, 2009
  22. martin f krafftMay 13, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.