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

Unified Diff: gclient.py

Issue 8994016: [depot_tools] Disabling new git checkouts with safesync_urls until fixed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: code review nit Created 9 years 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 | gclient_scm.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient.py
diff --git a/gclient.py b/gclient.py
index c804186e858dc56b9d018008ceb742a5a93eb9c0..041dc369073d1bfe8e4dcce8c35319e8dc8711c7 100644
--- a/gclient.py
+++ b/gclient.py
@@ -920,18 +920,7 @@ solutions = [
if not s.managed:
self._options.revisions.append('%s@unmanaged' % s.name)
elif s.safesync_url:
- handle = urllib.urlopen(s.safesync_url)
- rev = handle.read().strip()
- handle.close()
- scm = gclient_scm.CreateSCM(s.url, s.root.root_dir, s.name)
- safe_rev = scm.GetUsableRev(rev=rev, options=self._options)
- if not safe_rev:
- raise gclient_utils.Error(
- 'Despite our best attempts, we couldn\'t find a useful\n'
- 'safesync_url revision for you.')
- if self._options.verbose:
- print('Using safesync_url revision: %s.\n' % safe_rev)
- self._options.revisions.append('%s@%s' % (s.name, safe_rev))
+ self._ApplySafeSyncRev(dep=s)
if not self._options.revisions:
return revision_overrides
solutions_names = [s.name for s in self.dependencies]
@@ -950,6 +939,25 @@ solutions = [
index += 1
return revision_overrides
+ def _ApplySafeSyncRev(self, dep):
+ """Finds a valid revision from the content of the safesync_url and apply it
+ by appending revisions to the revision list. Throws if revision appears to
+ be invalid for the given |dep|."""
+ assert len(dep.safesync_url) > 0
+ handle = urllib.urlopen(dep.safesync_url)
+ rev = handle.read().strip()
+ handle.close()
+ if not rev:
+ raise gclient_utils.Error(
+ 'It appears your safesync_url (%s) is not working properly\n'
+ '(as it returned an empty response). Check your config.' %
+ dep.safesync_url)
+ scm = gclient_scm.CreateSCM(dep.url, dep.root.root_dir, dep.name)
+ safe_rev = scm.GetUsableRev(rev=rev, options=self._options)
+ if self._options.verbose:
+ print('Using safesync_url revision: %s.\n' % safe_rev)
+ self._options.revisions.append('%s@%s' % (dep.name, safe_rev))
+
def RunOnDeps(self, command, args):
"""Runs a command on each dependency in a client and its dependencies.
« no previous file with comments | « no previous file | gclient_scm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698