git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] topgit  tg push feature
@ 2009-04-25 16:13 Marc Weber
  2009-04-25 16:34 ` Marc Weber
  0 siblings, 1 reply; 22+ messages in thread
From: Marc Weber @ 2009-04-25 16:13 UTC (permalink / raw)
  To: git; +Cc: u.kleine-koenig

The patch should apply cleanly on 9f685cd79.
Or fetch it from branch t/tg-push at git://mawercer.de/topGit

Until now you've had two choices:

git push --all # pushing all top-bases and all other branches
or run
git push t/foo top-bases/foo # + all deps manually

tg push allows you to
a) push branch and its base, the branch you're on is used
b) push branch its deps and their bases (adding -r)

using tg push remoteA remoteB you can push to multiple remote locations.

Marc Weber

commit 2db369ff6dcfe9d5c4a9bab3eaf33c2a9b742f3d
Author: Marc Weber <marco-oweber@gmx.de>
Date:   Sat Apr 25 17:52:44 2009 +0200

    add tg-push [-r] pushing the branch and its base
    
    -r: also push tgish dependencies
    
    Signed-off-by: Marc Weber <marco-oweber@gmx.de>

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..f90a7b3 100644
--- a/README
+++ b/README
@@ -480,6 +480,13 @@ tg update
 
 	TODO: tg update -a for updating all topic branches
 
+tg push
+~~~~~~~
+	git push remote branch doesn't push the base.
+        git push remote pushes all branches (and bases)
+        You use tg push [-r] to push only the current branch [ and deps] with
+        its base to a remote location.
+
 TODO: tg rename
 
 
diff --git a/tg-push.sh b/tg-push.sh
new file mode 100644
index 0000000..0f8c964
--- /dev/null
+++ b/tg-push.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+# TopGit - A different patch queue manager
+# GPLv2
+
+recurse=
+remotes=
+
+
+## Parse options
+
+while [ -n "$1" ]; do
+	arg="$1"; shift
+	case "$arg" in
+	-r)
+		recurse=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(){

+	echo "$_dep" >> "$to_be_pushed"
+	base="top-bases/$_dep"
+	if ref_exists "$base"; then
+		echo "top-bases/$_dep" >> "$to_be_pushed"
+	else
+		echo "warning, no base found $base"
+	fi
+}
+
+to_be_pushed="$(mktemp -t tg-depsfile.XXXXXX)"
+trap 'rm -rf "$to_be_pushed"' EXIT
+
+for remote in $remotes; do
+	: > $to_be_pushed # empty file
+
+	if [ -n "$recurse" ]; then
+		recurse_deps push_branch "$name"
+	fi
+	_dep="$name"
+	_dep_is_tgish=1
+	push_branch
+	echo git push $remote `cat $to_be_pushed`
+	git push $remote `cat $to_be_pushed`
+done
diff --git a/tg-push.txt b/tg-push.txt
new file mode 100644
index 0000000..de9b259
--- /dev/null
+++ b/tg-push.txt
@@ -0,0 +1,3 @@
+	push branch and base. If you also use -r all tgish dependencies
+        will be pushed as well.
+        Use tg push remoteA remoteB to push to remoteA and remoteB locations

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2009-05-13 11:42 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-25 16:13 [PATCH] topgit tg push feature Marc Weber
2009-04-25 16:34 ` Marc Weber
2009-05-05  9:34   ` Marc Weber
2009-05-07  4:59     ` Marc Weber
2009-05-07  5:45       ` Bert Wesarg
2009-05-07  8:43         ` Uwe Kleine-König
2009-05-07  9:50           ` Bert Wesarg
2009-05-09 10:36             ` martin f krafft
2009-05-09 19:09               ` Marc Weber
2009-05-11  3:28                 ` Marc Weber
2009-05-11  7:25                   ` martin f krafft
2009-05-11  7:47                   ` martin f krafft
2009-05-11 19:55                   ` Uwe Kleine-König
2009-05-11 21:06                     ` Marc Weber
2009-05-11 21:39                       ` martin f krafft
2009-05-12  5:13                       ` Uwe Kleine-König
2009-05-12  6:22                         ` Bert Wesarg
2009-05-12  7:54                         ` Marc Weber
2009-05-12  8:55                           ` Bert Wesarg
2009-05-12  9:02                             ` Uwe Kleine-König
2009-05-13 10:04                               ` [PATCH] tg-remote: don't add push specs but warn about existing ones Uwe Kleine-König
2009-05-13 11:42                                 ` martin f krafft

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).