OLD | NEW |
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-crup [-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 git ls-files -s | grep ^160000 | awk '{print $4}' | |
28 xargs -L 1 -P "$j" $ECHO git submodule update --init ) | 28 xargs -L 1 -P "$j" $ECHO git submodule update --init ) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 fi | 71 fi |
72 | 72 |
73 ls -d */.git | | 73 ls -d */.git | |
74 while read gitdir; do | 74 while read gitdir; do |
75 parallel_update `dirname $gitdir` | 75 parallel_update `dirname $gitdir` |
76 done | 76 done |
77 | 77 |
78 test "$hooks" = "yes" && test -x src/.git/hooks/deps2hooks.sh && | 78 test "$hooks" = "yes" && test -x src/.git/hooks/deps2hooks.sh && |
79 src/.git/hooks/deps2hooks.sh | 79 src/.git/hooks/deps2hooks.sh |
80 | 80 |
OLD | NEW |