git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Campbell <pcampbell@kemitix.net>
To: git <git@vger.kernel.org>
Cc: David Michael Barr <b@rr-dav.id.au>, Kindjal <kindjal@gmail.com>,
	bibendi <bibendi@bk.ru>, Herman van Rink <rink@initfour.nl>,
	mhoffman <matt.hoffman@quantumretail.com>,
	Nate Jones <nate@endot.org>
Subject: [PATCH 04/19] new commands: pull_all and push_all
Date: Sat, 9 Mar 2013 19:23:36 +0000	[thread overview]
Message-ID: <CALeLG_=fB+-f52k6VKH990BinghrcnAC+9s5jheHVoPnqOG6iA@mail.gmail.com> (raw)

>From 7e20edee694cbcbac79be4fbe37d9cedebe3e4ee Mon Sep 17 00:00:00 2001
From: Paul Campbell <pcampbell@kemitix.net>
Date: Sat, 9 Mar 2013 18:31:37 +0000
Subject: [PATCH 04/19] new commands: pull_all and push_all

Conflicts:
	contrib/subtree/git-subtree.sh

Original-Author: bibendi <bibendi@bk.ru>
Conflicts-resolved-by: Paul Campbell <pcampbell@kemitix.net>
---
 contrib/subtree/git-subtree.sh | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index cb9e288..c3b1208 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -12,6 +12,7 @@ git subtree add   --prefix=<prefix> <commit>
 git subtree add   --prefix=<prefix> <repository> <commit>
 git subtree merge --prefix=<prefix> <commit>
 git subtree pull  --prefix=<prefix> <repository> <refspec...>
+git subtree pull_all
 git subtree push  --prefix=<prefix> <repository> <refspec...>
 git subtree split --prefix=<prefix> <commit...>
 git subtree from-submodule --prefix=<prefix>
@@ -102,16 +103,18 @@ done
 command="$1"
 shift
 case "$command" in
-	add|merge|pull|from-submodule) default= ;;
+	add|merge|pull|from-submodule|pull_all|push_all) default= ;;
 	split|push) default="--default HEAD" ;;
 	*) die "Unknown command '$command'" ;;
 esac

-if [ -z "$prefix" ]; then
+if [ -z "$prefix" -a "$command" != "pull_all" -a "$command" !=
"push_all" ]; then
 	die "You must provide the --prefix option."
 fi

 case "$command" in
+    pull_all);;
+    push_all);;
 	add) [ -e "$prefix" ] &&
 		die "prefix '$prefix' already exists." ;;
 	*)   [ -e "$prefix" ] ||
@@ -120,7 +123,7 @@ esac

 dir="$(dirname "$prefix/.")"

-if [ "$command" != "pull" -a "$command" != "add" -a "$command" !=
"push" ]; then
+if [ "$command" != "pull" -a "$command" != "add" -a "$command" !=
"push" -a "$command" != "pull_all" ]; then
 	revs=$(git rev-parse $default --revs-only "$@") || exit $?
 	dirs="$(git rev-parse --no-revs --no-flags "$@")" || exit $?
 	if [ -n "$dirs" ]; then
@@ -760,4 +763,20 @@ cmd_from-submodule()
 	rm -rf $tmp_repo
 }

+cmd_pull_all()
+{
+    git config -f .gittrees -l | grep subtree | grep path | grep -o
'=.*' | grep -o '[^=].*' |
+        while read path; do
+            git subtree pull -P $path master || exit $?
+        done
+}
+
+cmd_push_all()
+{
+    git config -f .gittrees -l | grep subtree | grep path | grep -o
'=.*' | grep -o '[^=].*' |
+        while read path; do
+            git subtree push -P $path master || exit $?
+        done
+}
+
 "cmd_$command" "$@"
-- 
1.8.2.rc1


-- 
Paul [W] Campbell

                 reply	other threads:[~2013-03-09 19:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALeLG_=fB+-f52k6VKH990BinghrcnAC+9s5jheHVoPnqOG6iA@mail.gmail.com' \
    --to=pcampbell@kemitix.net \
    --cc=b@rr-dav.id.au \
    --cc=bibendi@bk.ru \
    --cc=git@vger.kernel.org \
    --cc=kindjal@gmail.com \
    --cc=matt.hoffman@quantumretail.com \
    --cc=nate@endot.org \
    --cc=rink@initfour.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).