aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/git-sync-deps
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2015-11-03 09:50:03 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-11-03 09:50:03 -0800
commit6aff54c32283614dc5d5acde82aef6919bc166da (patch)
treeb092f56c7f2dbfa5843a9468e68fa9389a5305fa /tools/git-sync-deps
parent444d91fec1b51b53a77e79a47a63a944f64b32f8 (diff)
tools/git-sync-deps: speed up common case by skipping fetch
Diffstat (limited to 'tools/git-sync-deps')
-rwxr-xr-xtools/git-sync-deps9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/git-sync-deps b/tools/git-sync-deps
index 1d626d066c..92adf4e855 100755
--- a/tools/git-sync-deps
+++ b/tools/git-sync-deps
@@ -133,6 +133,13 @@ def git_checkout_to_directory(git, repo, checkoutable, directory, verbose):
sys.stdout.write('%s\n SYNC IS DISABLED.\n' % directory)
return
+ if 0 == subprocess.call(
+ [git, 'checkout', '--quiet', checkoutable], cwd=directory):
+ # if this succeeds, skip slow `git fetch`.
+ if verbose:
+ sys.stdout.write('%s\n @ %s\n' % (directory, checkoutable))
+ return
+
subprocess.check_call([git, 'fetch', '--quiet'], cwd=directory)
subprocess.check_call(
@@ -176,7 +183,7 @@ def git_sync_deps(deps_file_path, command_line_os_requests, verbose):
if '@' in dependencies[directory]:
repo, checkoutable = dependencies[directory].split('@', 1)
else:
- repo, checkoutable = dependencies[directory], 'origin/master'
+ raise Exception("please specify commit or tag")
relative_directory = os.path.join(deps_file_directory, directory)