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

Re: [PATCH] topgit tg push feature

From
Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date
May 12, 2009, 05:13 UTC
Message-ID
<20090512051334.GA22757@pengutronix.de>
In-Reply-To
<20090511210614.GA6118@gmx.de>
Hello Marc,
On Mon, May 11, 2009 at 11:06:14PM +0200, Marc Weber wrote:
Show 5 quoted lines
> Thanks to Bert Wesarg, Uwe Kleine-König and Martin f Krafft the
> patch is finally ready to be comitted (?) I included ukleineks last
> nitpicks.
> 
> ukleinek, usage line: remote2 = just another remote location.

hhm, so you suggest that you can add more than one remote per -r option? I wouldn't document even if it works now.

Show 72 quoted lines
> diff --git a/.gitignore b/.gitignore
> index eb56446..2f6d991 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -21,6 +21,8 @@
>  /tg-import.txt
>  /tg-remote
>  /tg-remote.txt
> +/tg-push
> +/tg-push.txt
>  /tg
>  .*.swp
>  
> diff --git a/README b/README
> index d2f095d..495c70b 100644
> --- a/README
> +++ b/README
> @@ -480,6 +480,12 @@ tg update
>  
>  	TODO: tg update -a for updating all topic branches
>  
> +tg push
> +~~~~~~~
> +	pushes a TopGit-controlled topic branch to a remote
> +	repository.  By default the remote gets all dependencies
> +	(both tgish and non-tgish) and bases pushed to.
> +
>  TODO: tg rename
>  
>  
> diff --git a/tg-push.sh b/tg-push.sh
> new file mode 100644
> index 0000000..5df5073
> --- /dev/null
> +++ b/tg-push.sh
> @@ -0,0 +1,78 @@
> +#!/bin/sh
> +# TopGit - A different patch queue manager
> +# GPLv2
> +
> +remotes="$base_remote" # honor -r flag of the tg command
> +
> +## Parse options see README
> +
> +recurse_deps=true
> +tgish_deps_only=false
> +dry_run=
> +
> +while [ -n "$1" ]; do
> +	arg="$1"; shift
> +	case "$arg" in
> +	--no-deps)
> +		recurse_deps=false;;
> +	--dry-run)
> +		dry_run=--dry-run;;
> +	--tgish-only)
> +		tgish_deps_only=true;;
> +	-h|--help)
> +		echo "Usage: tg [-r remote] push [--dry-run] [--no-deps] [--tgish-only] [-r "remote2 remote3"]* branch*"
> +		exit 0;;
> +	-r)
> +		remotes="$remotes $1"
> +		shift
> +		;;
> +	*)
> +		branches="$branches $arg";;
> +	esac
> +done
> +
> +if [ -z "$remotes" ]; then
> +	remotes="$(git config topgit.remote 2>/dev/null)"
> +fi
This is obsolete with remotes=$base_remote above, right?
Show 73 quoted lines
> +if [ -z "$remotes" ]; then
> +	die "no remote location given. Either use -r remote argument or set topgit.remote"
> +fi
> +
> +if [ -z "$branches" ]; then
> +	branches="$(git symbolic-ref HEAD | sed 's#^refs/heads/##')"
> +fi
> +
> +for name in $branches; do
> +	ref_exists "$name" || die "detached HEAD? Can't push $name"
> +done
> +
> +push_branch(){
> +	# if so desired omit non tgish deps
> +	$tgish_deps_only && [ -z "$_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
> +	for name in $branches; do
> +		list="$(
> +			# deps
> +			if $recurse_deps; then
> +				no_remotes=1 recurse_deps push_branch "$name"
> +			fi
> +			# current branch
> +			_dep="$name"
> +			_dep_is_tgish=1
> +			push_branch "$name"
> +		)"
> +		echo "pushing:"; echo $list
> +        git push $dry_run "$remote" $list
> +	done
> +done
> diff --git a/tg.sh b/tg.sh
> index 0804f73..7d98dbd 100644
> --- a/tg.sh
> +++ b/tg.sh
> @@ -136,6 +136,7 @@ branch_annihilated()
>  # of the whole function.
>  # If recurse_deps() hits missing dependencies, it will append
>  # them to space-separated $missing_deps list and skip them.
> +# set no_remotes to any value to omit remote dependencies (-> tg push)
>  recurse_deps()
>  {
>  	_cmd="$1"; shift
> @@ -145,9 +146,8 @@ recurse_deps()
>  	_depsfile="$(mktemp -t tg-depsfile.XXXXXX)"
>  	# Check also our base against remote base. Checking our head
>  	# against remote head has to be done in the helper.
> -	if has_remote "top-bases/$_name"; then
> +	has_remote "top-bases/$_name" && [ -z "$no_remotes" ] &&
>  		echo "refs/remotes/$base_remote/top-bases/$_name" >>"$_depsfile"
> -	fi
>  
>  	# if the branch was annihilated, there exists no .topdeps file
>  	if ! branch_annihilated "$_name"; then
> @@ -366,6 +366,8 @@ help|--help|-h)
>  --hooks-path)
>  	# Internal command
>  	echo "@hooksdir@";;
> +eval)
> +	eval "$@";;
>  *)
>  	[ -r "@cmddir@"/tg-$cmd ] || {
>  		echo "Unknown subcommand: $cmd" >&2
hhhm, this hunk is new and unused.  Intended?

If it's OK for you I fix these up when commiting. I will break out the change to tg.sh as shown yesterday in irc.

Best regards Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |
Previous: martin f krafftNext: Bert Wesarg
Message 16 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.