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

Unified Diff: gclient_scm.py

Issue 10668020: Skip updating remotes if we already have the upstream revision. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: . Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_scm.py
diff --git a/gclient_scm.py b/gclient_scm.py
index 68f3be328e86c1c0b0ab73bc0919d08f29d03b01..0f34d38601fc3d3ebd9df62b775ec9e7e249db79 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -353,27 +353,28 @@ class GitWrapper(SCMWrapper):
else:
raise gclient_utils.Error('Invalid Upstream: %s' % upstream_branch)
- # Update the remotes first so we have all the refs.
- backoff_time = 5
- for _ in range(10):
- try:
- remote_output = scm.GIT.Capture(
- ['remote'] + verbose + ['update'],
- cwd=self.checkout_path)
- break
- except subprocess2.CalledProcessError, e:
- # Hackish but at that point, git is known to work so just checking for
- # 502 in stderr should be fine.
- if '502' in e.stderr:
- print(str(e))
- print('Sleeping %.1f seconds and retrying...' % backoff_time)
- time.sleep(backoff_time)
- backoff_time *= 1.3
- continue
- raise
+ if not scm.GIT.IsValidRevision(cwd=self.checkout_path, rev=revision):
+ # Update the remotes first so we have all the refs.
+ backoff_time = 5
+ for _ in range(10):
+ try:
+ remote_output = scm.GIT.Capture(
+ ['remote'] + verbose + ['update'],
+ cwd=self.checkout_path)
+ break
+ except subprocess2.CalledProcessError, e:
+ # Hackish but at that point, git is known to work so just checking for
+ # 502 in stderr should be fine.
+ if '502' in e.stderr:
+ print(str(e))
+ print('Sleeping %.1f seconds and retrying...' % backoff_time)
+ time.sleep(backoff_time)
+ backoff_time *= 1.3
+ continue
+ raise
- if verbose:
- print(remote_output.strip())
+ if verbose:
+ print(remote_output.strip())
# This is a big hammer, debatable if it should even be here...
if options.force or options.reset:
« 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