Do not check the safesync_url at all if one or more --revision flags are
specified.
BUG=49625
TEST=tests\gclient_smoketest.py runs successfully
Review URL: http://codereview.chromium.org/4698006
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@65620 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient.py b/gclient.py
index 38e1fef..157630b 100644
--- a/gclient.py
+++ b/gclient.py
@@ -677,17 +677,18 @@
revision_overrides = {}
if self._options.head:
return revision_overrides
- for s in self.dependencies:
- if not s.safesync_url:
- continue
- handle = urllib.urlopen(s.safesync_url)
- rev = handle.read().strip()
- handle.close()
- if len(rev):
- self._options.revisions.append('%s@%s' % (s.name, rev))
+ # Do not check safesync_url if one or more --revision flag is specified.
+ if not self._options.revisions:
+ for s in self.dependencies:
+ if not s.safesync_url:
+ continue
+ handle = urllib.urlopen(s.safesync_url)
+ rev = handle.read().strip()
+ handle.close()
+ if len(rev):
+ self._options.revisions.append('%s@%s' % (s.name, rev))
if not self._options.revisions:
return revision_overrides
- # --revision will take over safesync_url.
solutions_names = [s.name for s in self.dependencies]
index = 0
for revision in self._options.revisions:
@@ -1037,7 +1038,8 @@
'format src@rev. The src@ part is optional and can be '
'skipped. -r can be used multiple times when .gclient '
'has multiple solutions configured and will work even '
- 'if the src@ part is skipped.')
+ 'if the src@ part is skipped. Note that specifying '
+ '--revision means your safesync_url gets ignored.')
parser.add_option('-H', '--head', action='store_true',
help='skips any safesync_urls specified in '
'configured solutions and sync to head instead')