Re: [PATCH] topgit tg push feature

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Marc Weber
Date: Wednesday, May 6, 2009 - 9:59 pm

Uwe K,

what do you think. Is there still much to change to include this patch into
upstream?

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*
+	
+	$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. You may add --no-deps and or --tgish-only
+	to change this default behaviour. Probably youn never want
+	to do this
+
 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
+
+if [ -z "$remotes" ]; then
+	remotes="$(git config topgit.remote 2>/dev/null)"
+fi
+
+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"
+
+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
+done
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] topgit tg push feature, Marc Weber, (Sat Apr 25, 9:13 am)
Re: [PATCH] topgit tg push feature, Marc Weber, (Sat Apr 25, 9:34 am)
Re: [PATCH] topgit tg push feature, Marc Weber, (Tue May 5, 2:34 am)
Re: [PATCH] topgit tg push feature, Marc Weber, (Wed May 6, 9:59 pm)
Re: [PATCH] topgit tg push feature, Bert Wesarg, (Wed May 6, 10:45 pm)
Re: [PATCH] topgit tg push feature, Uwe =?iso-8859-1?Q?K ..., (Thu May 7, 1:43 am)
Re: [PATCH] topgit tg push feature, Bert Wesarg, (Thu May 7, 2:50 am)
Re: [PATCH] topgit tg push feature, martin f krafft, (Sat May 9, 3:36 am)
Re: [PATCH] topgit tg push feature, Marc Weber, (Sat May 9, 12:09 pm)
Re: [PATCH] topgit tg push feature, Marc Weber, (Sun May 10, 8:28 pm)
Re: [PATCH] topgit tg push feature, martin f krafft, (Mon May 11, 12:25 am)
Re: [PATCH] topgit tg push feature, martin f krafft, (Mon May 11, 12:47 am)
Re: [PATCH] topgit tg push feature, Uwe =?iso-8859-1?Q?K ..., (Mon May 11, 12:55 pm)
Re: [PATCH] topgit tg push feature, Marc Weber, (Mon May 11, 2:06 pm)
Re: [PATCH] topgit tg push feature, martin f krafft, (Mon May 11, 2:39 pm)
Re: [PATCH] topgit tg push feature, Uwe =?iso-8859-1?Q?K ..., (Mon May 11, 10:13 pm)
Re: [PATCH] topgit tg push feature, Bert Wesarg, (Mon May 11, 11:22 pm)
Re: [PATCH] topgit tg push feature, Marc Weber, (Tue May 12, 12:54 am)
Re: [PATCH] topgit tg push feature, Bert Wesarg, (Tue May 12, 1:55 am)
Re: [PATCH] topgit tg push feature, Uwe =?iso-8859-1?Q?K ..., (Tue May 12, 2:02 am)
[PATCH] tg-remote: don't add push specs but warn about exi ..., =?utf-8?q?Uwe=20Klei ..., (Wed May 13, 3:04 am)