From: Paul Campbell <pcampbell@kemitix.net>
To: git <git@vger.kernel.org>
Cc: David Greene <greened@obbligato.org>, bibendi <bibendi@bk.ru>,
Paul Campbell <pcampbell@kemitix.net>,
"Peter Jaros" <pjaros@pivotallabs.com>,
"Avery Pennarun" <apenwarr@gmail.com>,
"Win Treese" <treese@acm.org>,
"Wayne Walter" <wayne@tickzoom.com>
Subject: [PATCH v2 05/23] contrib/subtree: Add commands pull_all and push_all
Date: Sun, 10 Mar 2013 23:41:13 +0000 [thread overview]
Message-ID: <1362958891-26941-6-git-send-email-pcampbell@kemitix.net> (raw)
In-Reply-To: <1362958891-26941-1-git-send-email-pcampbell@kemitix.net>
From: bibendi <bibendi@bk.ru>
For each subtree listed in .gittrees perform a push or a pull.
Signed-off-by: Paul Campbell <pcampbell@kemitix.net>
Conflicts:
contrib/subtree/git-subtree.sh
---
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 1aff956..ddae56e 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
@@ -767,4 +770,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
next prev parent reply other threads:[~2013-03-10 23:44 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-10 23:41 [PATCH v2 00/23] contrib/subtree: Collected updates Paul Campbell
2013-03-10 23:41 ` [PATCH v2 01/23] contrib/subtree: Fix typo (s/incldued/included/) Paul Campbell
2013-03-10 23:41 ` [PATCH v2 02/23] contrib/subtree: Add command from-submodule Paul Campbell
2013-03-11 3:19 ` Junio C Hamano
2013-03-24 20:59 ` [PATCH] " Paul Campbell
2013-03-10 23:41 ` [PATCH v2 03/23] contrib/subtree: Teach add to store repository & branch in .gittrees Paul Campbell
2013-03-11 3:24 ` Junio C Hamano
2013-03-24 20:17 ` Paul Campbell
2013-03-24 20:22 ` [PATCH] " Paul Campbell
2013-03-10 23:41 ` [PATCH v2 04/23] contrib/subtree: Teach push and pull to use .gittrees for defaults Paul Campbell
2013-03-11 3:35 ` Junio C Hamano
2013-03-24 21:22 ` Paul Campbell
2013-03-10 23:41 ` Paul Campbell [this message]
2013-03-11 5:03 ` [PATCH v2 05/23] contrib/subtree: Add commands pull_all and push_all Junio C Hamano
2013-03-11 11:49 ` Paul Campbell
2013-03-10 23:41 ` [PATCH v2 06/23] contrib/subtree: Rename commands push_all/pull_all to push-all/pull-all Paul Campbell
2013-03-10 23:41 ` [PATCH v2 07/23] contrib/subtree: Teach push and pull to use .gittrees if needed Paul Campbell
2013-03-10 23:41 ` [PATCH v2 08/23] contrib/subtree: Replace invisible carriage return with a visible \r Paul Campbell
2013-03-10 23:41 ` [PATCH v2 09/23] contrib/subtree: Teach push to abort if split fails Paul Campbell
2013-03-10 23:41 ` [PATCH v2 10/23] contrib/subtree: Add command diff Paul Campbell
2013-03-10 23:41 ` [PATCH v2 11/23] contrib/subtree: Add command list Paul Campbell
2013-03-10 23:41 ` [PATCH v2 12/23] contrib/subtree: Add command prune Paul Campbell
2013-03-10 23:41 ` [PATCH v2 13/23] contrib/subtree: Add prune command to OPTS_SPEC Paul Campbell
2013-03-10 23:41 ` [PATCH v2 14/23] contrib/subtree: Remove trailing slash from prefix parameter Paul Campbell
2013-03-10 23:41 ` [PATCH v2 15/23] contrib/subtree: Teach from-submodule to add new subtree to .gittrees Paul Campbell
2013-03-10 23:41 ` [PATCH v2 16/23] contrib/subtree: Document pull-all and push-all Paul Campbell
2013-03-10 23:41 ` [PATCH v2 17/23] contrib/subtree: Document from-submodule and prune commands Paul Campbell
2013-03-10 23:41 ` [PATCH v2 18/23] contrib/subtree: Add missing commands to SYNOPSIS Paul Campbell
2013-03-10 23:41 ` [PATCH v2 19/23] contrib/subtree: Document list command Paul Campbell
2013-03-10 23:41 ` [PATCH v2 20/23] contrib/subtree: Teach push to use --force option Paul Campbell
2013-03-10 23:41 ` [PATCH v2 21/23] contrib/subtree: Convert spaces to tabs and remove some trailing whitespace Paul Campbell
2013-03-10 23:41 ` [PATCH v2 22/23] contrib/subtree: Parameters repository/branch for push/pull are optional Paul Campbell
2013-03-10 23:41 ` [PATCH v2 23/23] contrib/subtree: Fix order of case switches so default case is last Paul Campbell
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=1362958891-26941-6-git-send-email-pcampbell@kemitix.net \
--to=pcampbell@kemitix.net \
--cc=apenwarr@gmail.com \
--cc=bibendi@bk.ru \
--cc=git@vger.kernel.org \
--cc=greened@obbligato.org \
--cc=pjaros@pivotallabs.com \
--cc=treese@acm.org \
--cc=wayne@tickzoom.com \
/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).