Misc gclient cleanup
- Use config --local for properties that should be local.
- Remove git fetch retry logic, it should not be necessary
with the googlesource hosts.
- Include .strip() in GIT.Capture, simplifying other calls.
- Safer testing of whether dep revision is a sha.
- Fix refs/remotes/ DEPS branch detection
Review URL: https://chromiumcodereview.appspot.com/18262002
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@209825 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient_scm.py b/gclient_scm.py
index 5c3929a..5d12f40 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -297,7 +297,7 @@
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'
@@ -406,29 +406,12 @@
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)