Commit 69aea165 authored by szager@chromium.org's avatar szager@chromium.org

Add --sync option, to only sync submodules.

Also add git-crsync as shorthand for `git crup --sync`.

TBR=iannucci@chromium.org

BUG=

Review URL: https://codereview.chromium.org/12279006

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@182767 0039d316-1c4b-4281-b951-d872f2087c98
parent 0ecad9c0
#!/bin/bash
update_toplevel () {
# Don't "pull" if checkout is not on a named branch
if test "$2" = "pull" && ( ! git symbolic-ref HEAD >/dev/null 2>/dev/null ); then
first_args="$1 fetch"
else
first_args="$1 $2"
fi
shift 2
echo "[$solution] $first_args $@" 1>&2
$first_args $@ | sed "s/^/[$solution] /g" 1>&2
status=$?
if [ "$status" -ne 0 ]; then
exit $status
fi
}
set_target_os () {
# Get the os we're building for. On first run, this will be unset.
target_os=$(git config target.os 2>/dev/null)
......@@ -70,18 +86,9 @@ if [ "$solution" = "$1" ]; then
exit 0
fi
# Don't "pull" if checkout is not on a named branch
shift
if test "$2" = "pull" && ( ! git symbolic-ref HEAD >/dev/null 2>/dev/null ); then
first_args="$1 fetch"
else
first_args="$1 $2"
fi
shift 2
$first_args $@ | sed "s/^/[$solution] /g" 1>&2
status=$?
if [ "$status" -ne 0 ]; then
exit $status
if test $# -ne 0; then
update_toplevel "$@"
fi
set_target_os
......
#!/bin/bash
exec bash git-crup --sync "$@"
......@@ -45,16 +45,18 @@ fi
usage() {
cat <<EOF
Usage: git-crup [-n|--dry-run] [--fetch] [-j|--jobs [jobs]]
Usage: git-crup [-n|--dry-run] [--fetch|--sync] [-j|--jobs [jobs]]
[--no-hooks] [<args to git-pull or git-fetch>]
EOF
}
serial_update() {
( cd "$1"
$GIT_EXE $pull $pull_args -q origin | sed "s/^/[$1] /g"
if [ $? -ne 0 ]; then
return $?
if test -n "$toplevel_cmd"; then
$toplevel_cmd | sed "s/^/[$1] /g"
if [ $? -ne 0 ]; then
return $?
fi
fi
$GIT_EXE submodule --quiet sync
$GIT_EXE ls-files -s | grep ^160000 | awk '{print $4}' |
......@@ -93,6 +95,9 @@ while test $# -ne 0; do
--fetch)
pull=fetch
;;
--sync)
pull=
;;
--no-hooks|--nohooks)
hooks=no
;;
......@@ -124,11 +129,17 @@ else
xargs_parallel=no
fi
if test -n "$pull"; then
toplevel_cmd="$GIT_EXE $pull $pull_args -q origin"
else
toplevel_cmd=
fi
set -o pipefail
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 |
"$crup_runner" replace_arg $toplevel_cmd |
xargs $max_lines -P "$j" "$crup_runner" )
else
ls -d */.git |
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment