Chromium Code Reviews
|
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/bin/sh | |
| 2 | |
|
cmp
2012/07/30 17:22:04
can you add a brief comment at the top of the file
szager1
2012/07/30 17:49:57
Done.
| |
| 3 j=10 | |
| 4 ECHO= | |
| 5 pull=pull | |
| 6 pull_args= | |
| 7 hooks=yes | |
| 8 | |
| 9 usage() { | |
| 10 cat <<EOF 1>&2 | |
| 11 Usage: git-cr-sync [-n|--dry-run] [--fetch] [-j|--jobs [jobs]] | |
|
cmp
2012/07/30 17:22:04
git-crsync would avoid an extra trip to the dash s
szager1
2012/07/30 17:49:57
Done.
| |
| 12 [--no-hooks] [<args to git-pull or git-fetch>] | |
| 13 EOF | |
| 14 } | |
| 15 | |
| 16 parallel_update() { | |
| 17 ( echo Entering "$1" && | |
| 18 cd "$1" && | |
| 19 $ECHO git $pull $pull_args origin && | |
| 20 git ls-files -s | grep ^160000 | awk '{print $4}' | | |
| 21 xargs -L 1 -P "$j" $ECHO git submodule update --init ) | |
| 22 } | |
| 23 | |
| 24 while test $# -ne 0; do | |
| 25 case "$1" in | |
| 26 -j|--jobs) | |
| 27 if test -n "$2"; then | |
| 28 j="$2" | |
| 29 shift | |
| 30 else | |
| 31 j=0 | |
| 32 fi | |
| 33 ;; | |
| 34 -n|--dry-run) | |
| 35 ECHO=echo | |
| 36 ;; | |
| 37 -h|--help) | |
| 38 usage | |
| 39 exit 0 | |
| 40 ;; | |
| 41 --fetch) | |
| 42 pull=fetch | |
| 43 ;; | |
| 44 --no-hooks) | |
| 45 hooks=no | |
| 46 ;; | |
| 47 *) | |
| 48 pull_args="$pull_args $1" | |
| 49 break | |
| 50 ;; | |
| 51 esac | |
| 52 shift | |
| 53 done | |
| 54 | |
| 55 while test "$PWD" != "/"; do | |
| 56 if test -f "$PWD/src/.gitmodules"; then | |
| 57 break | |
| 58 fi | |
| 59 cd .. | |
| 60 done | |
| 61 if test "$PWD" = "/"; then | |
| 62 echo "Could not find the root of your checkout; aborting." 1>&2 | |
| 63 exit 1 | |
| 64 fi | |
| 65 | |
| 66 ls -d */.git | | |
| 67 while read gitdir; do | |
| 68 parallel_update `dirname $gitdir` | |
| 69 done | |
| 70 | |
| 71 test "$hooks" = "yes" && test -x src/.git/hooks/deps2hooks.sh && | |
| 72 src/.git/hooks/deps2hooks.sh | |
| OLD | NEW |