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

Side by Side Diff: git-crup

Issue 10820057: Convenience script to update a submodule-based checkout. (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')
Property Changes:
Added: svn:executable
+ *
OLDNEW
(Empty)
1 #!/bin/sh
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
4 # found in the LICENSE file.
5
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;
8 # updates submodules; and runs post-sync hooks.
9
10 j=10
11 ECHO=
12 pull=pull
13 pull_args=
14 hooks=yes
15
16 usage() {
17 cat <<EOF 1>&2
18 Usage: git-cr-sync [-n|--dry-run] [--fetch] [-j|--jobs [jobs]]
19 [--no-hooks] [<args to git-pull or git-fetch>]
20 EOF
21 }
22
23 parallel_update() {
24 ( echo Entering "$1" &&
25 cd "$1" &&
26 $ECHO git $pull $pull_args origin &&
27 git ls-files -s | grep ^160000 | awk '{print $4}' |
28 xargs -L 1 -P "$j" $ECHO git submodule update --init )
29 }
30
31 while test $# -ne 0; do
32 case "$1" in
33 -j|--jobs)
34 if test -n "$2"; then
35 j="$2"
36 shift
37 else
38 j=0
39 fi
40 ;;
41 -n|--dry-run)
42 ECHO=echo
43 ;;
44 -h|--help)
45 usage
46 exit 0
47 ;;
48 --fetch)
49 pull=fetch
50 ;;
51 --no-hooks)
52 hooks=no
53 ;;
54 *)
55 pull_args="$pull_args $1"
56 break
57 ;;
58 esac
59 shift
60 done
61
62 while test "$PWD" != "/"; do
63 if test -f "$PWD/src/.gitmodules"; then
64 break
65 fi
66 cd ..
67 done
68 if test "$PWD" = "/"; then
69 echo "Could not find the root of your checkout; aborting." 1>&2
70 exit 1
71 fi
72
73 ls -d */.git |
74 while read gitdir; do
75 parallel_update `dirname $gitdir`
76 done
77
78 test "$hooks" = "yes" && test -x src/.git/hooks/deps2hooks.sh &&
79 src/.git/hooks/deps2hooks.sh
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