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

Unified Diff: gclient_scm.py

Issue 18262002: Misc gclient cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Improve IsValidRevision logic Created 7 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 | scm.py » ('j') | scm.py » ('J')
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 3e8f59c9ba837fb02eea5a3974bb96183c11e250..cb243a96f309c67b620cd029b0b53ef5a8b317c0 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -294,7 +294,7 @@ class GitWrapper(SCMWrapper):
verbose = ['--verbose']
printed_path = True
- if revision.startswith('refs/heads/'):
+ if revision.startswith('refs/'):
rev_type = "branch"
elif revision.startswith('origin/'):
# For compatability with old naming, translate 'origin' to 'refs/heads'
@@ -402,29 +402,12 @@ class GitWrapper(SCMWrapper):
else:
raise gclient_utils.Error('Invalid Upstream: %s' % upstream_branch)
- if (not re.match(r'^[0-9a-fA-F]{40}$', revision) or
- not scm.GIT.IsValidRevision(cwd=self.checkout_path, rev=revision)):
+ if not scm.GIT.IsValidRevision(self.checkout_path, revision, sha_only=True):
# 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'],
+ 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())
+ print(remote_output)
self._UpdateBranchHeads(options, fetch=True)
« no previous file with comments | « no previous file | scm.py » ('j') | scm.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698