Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Unified Diff: git-crup

Issue 11260036: Keep the parallel execution pipes full as much as possible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « crup-runner.sh ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git-crup
===================================================================
--- git-crup (revision 164136)
+++ git-crup (working copy)
@@ -7,36 +7,54 @@
# submodule-based checkout. Fetches latest commits for top-level solutions;
# updates submodules; and runs post-sync hooks.
-j=10
+export GIT_MERGE_AUTOEDIT=0
+
ECHO=
pull=pull
pull_args=
hooks=yes
+j=10
+crup_runner="crup-runner.sh"
+kernel_name=$(uname -s)
+if [ "${kernel_name:0:5}" = "MINGW" -o "${kernel_name:0:6}" = "CYGWIN" ]; then
+ GIT_EXE=git.exe
+else
+ GIT_EXE=git
+fi
+export GIT_EXE
+
if ( echo test | xargs --max-lines=1 true 2>/dev/null ); then
max_lines="--max-lines=1"
else
max_lines="-L 1"
fi
+if ( echo test | xargs -I bar true 2>/dev/null ); then
+ replace_arg="-I replace_arg"
+else
+ replace_arg="-ireplace_arg"
+fi
+
usage() {
- cat <<EOF 1>&2
+ cat <<EOF
Usage: git-crup [-n|--dry-run] [--fetch] [-j|--jobs [jobs]]
[--no-hooks] [<args to git-pull or git-fetch>]
EOF
}
-parallel_update() {
- ( echo Entering "$1"
- cd "$1"
- $ECHO git $pull $pull_args origin
- $ECHO git submodule sync
- if test "$xargs_parallel" = "yes"; then
- git ls-files -s | grep ^160000 | awk '{print $4}' |
- xargs $max_lines -P "$j" $ECHO git submodule update --init
- else
- $ECHO git submodule update --init
- fi )
+serial_update() {
+ ( cd "$1"
+ $GIT_EXE $pull $pull_args -q origin | sed "s/^/[$1] /g"
+ if [ $? -ne 0 ]; then
+ return $?
+ fi
+ $GIT_EXE submodule --quiet sync
+ $GIT_EXE ls-files -s | grep ^160000 | awk '{print $4}' |
+ while read submod; do
+ $GIT_EXE submodule update --init "$submod" | sed "s|^|[$1/$submod] |g"
+ done
+ )
}
while test $# -ne 0; do
@@ -68,7 +86,7 @@
--fetch)
pull=fetch
;;
- --no-hooks)
+ --no-hooks|--nohooks)
hooks=no
;;
*)
@@ -99,10 +117,27 @@
xargs_parallel=no
fi
-ls -d */.git |
-while read gitdir; do
- parallel_update `dirname $gitdir`
-done
+set -o pipefail
-gclient_spec="solutions=[{'name':'src','url':None,'deps_file':'.DEPS.git'}]"
-test "$hooks" = "yes" && gclient runhooks --spec="$gclient_spec"
+if test "$xargs_parallel" = "yes"; then
+ ( ls -d */.git | sed 's/\/\.git$//' |
+ xargs $max_lines $replace_arg -P "$j" \
+ "$crup_runner" replace_arg $GIT_EXE $pull $pull_args -q origin |
+ xargs $max_lines -P "$j" "$crup_runner" )
+else
+ ls -d */.git |
+ while read gitdir; do
+ serial_update "${gitdir%%/.git}"
+ done
+fi
+
+status=$?
+
+if [ "$hooks" = "yes" -a "$status" -eq 0 ]; then
+ gclient_spec="solutions=[{'name':'src','url':None,'deps_file':'.DEPS.git'}]"
+ gclient runhooks --spec="$gclient_spec"
+ status=$?
+fi
+
+echo
+exit $status
« no previous file with comments | « crup-runner.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698