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

Side by Side Diff: git-crup

Issue 10826064: Call `git submodule sync` to update upstream URL's, if necessary. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/sh 1 #!/bin/sh
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # A convenience script to largely replicate the behavior of `gclient sync` in a 6 # A convenience script to largely replicate the behavior of `gclient sync` in a
7 # submodule-based checkout. Fetches latest commits for top-level solutions; 7 # submodule-based checkout. Fetches latest commits for top-level solutions;
8 # updates submodules; and runs post-sync hooks. 8 # updates submodules; and runs post-sync hooks.
9 9
10 j=10 10 j=10
11 ECHO= 11 ECHO=
12 pull=pull 12 pull=pull
13 pull_args= 13 pull_args=
14 hooks=yes 14 hooks=yes
15 15
16 usage() { 16 usage() {
17 cat <<EOF 1>&2 17 cat <<EOF 1>&2
18 Usage: git-cr-sync [-n|--dry-run] [--fetch] [-j|--jobs [jobs]] 18 Usage: git-cr-sync [-n|--dry-run] [--fetch] [-j|--jobs [jobs]]
19 [--no-hooks] [<args to git-pull or git-fetch>] 19 [--no-hooks] [<args to git-pull or git-fetch>]
20 EOF 20 EOF
21 } 21 }
22 22
23 parallel_update() { 23 parallel_update() {
24 ( echo Entering "$1" && 24 ( echo Entering "$1"
25 cd "$1" && 25 cd "$1"
26 $ECHO git $pull $pull_args origin && 26 $ECHO git $pull $pull_args origin
27 git ls-files -s | grep ^160000 | awk '{print $4}' | 27 $ECHO git submodule sync
28 xargs -L 1 -P "$j" $ECHO git submodule update --init ) 28 if ( echo test | xargs --max-lines=1 true 2>/dev/null ); then
29 max_lines="--max-lines=1"
30 else
31 max_lines="-L 1"
32 fi
33 if ( echo test | xargs -P "$j" true 2>/dev/null )
34 then
35 git ls-files -s | grep ^160000 | awk '{print $4}' |
36 xargs $max_lines -P "$j" $ECHO git submodule update --init
37 else
38 echo "Warn: parallel execution is not supported on this platform."
39 $ECHO git submodule update --init
40 fi )
29 } 41 }
30 42
31 while test $# -ne 0; do 43 while test $# -ne 0; do
32 case "$1" in 44 case "$1" in
33 -j|--jobs) 45 -j|--jobs)
34 if test -n "$2"; then 46 if test -n "$2"; then
35 j="$2" 47 j="$2"
36 shift 48 shift
37 else 49 else
38 j=0 50 j=0
(...skipping 29 matching lines...) Expand all
68 if test "$PWD" = "/"; then 80 if test "$PWD" = "/"; then
69 echo "Could not find the root of your checkout; aborting." 1>&2 81 echo "Could not find the root of your checkout; aborting." 1>&2
70 exit 1 82 exit 1
71 fi 83 fi
72 84
73 ls -d */.git | 85 ls -d */.git |
74 while read gitdir; do 86 while read gitdir; do
75 parallel_update `dirname $gitdir` 87 parallel_update `dirname $gitdir`
76 done 88 done
77 89
78 test "$hooks" = "yes" && test -x src/.git/hooks/deps2hooks.sh && 90 gclient_spec="solutions=[{'name':'src','url':None,'deps_file':'.DEPS.git'}]"
79 src/.git/hooks/deps2hooks.sh 91 test "$hooks" = "yes" && gclient runhooks --spec="$gclient_spec"
80
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698