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

Unified Diff: gclient.py

Issue 290443003: Enable --revision flag for all deps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: nits scratchd Created 6 years, 7 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.py
diff --git a/gclient.py b/gclient.py
index 33f7911f0f3afa7688abc11adeebc95157bfcbb2..76de96f6ece8ecab6c3c385c789a48c12dd0a5ef 100755
--- a/gclient.py
+++ b/gclient.py
@@ -313,6 +313,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
# This is the scm used to checkout self.url. It may be used by dependencies
# to get the datetime of the revision we checked out.
self._used_scm = None
+ self._used_revision = None
# The actual revision we ended up getting, or None if that information is
# unavailable
self._got_revision = None
@@ -601,8 +602,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
self.add_dependency(dep)
self._mark_as_parsed(hooks)
- def maybeGetParentRevision(
- self, command, options, parsed_url, parent_name, revision_overrides):
+ def maybeGetParentRevision(self, command, options, parsed_url, parent):
"""Uses revision/timestamp of parent if no explicit revision was specified.
If we are performing an update and --transitive is set, use
@@ -615,7 +615,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
if command == 'update' and options.transitive and not options.revision:
_, revision = gclient_utils.SplitUrlRevision(parsed_url)
if not revision:
- options.revision = revision_overrides.get(parent_name)
+ options.revision = getattr(parent, '_used_revision', None)
if (options.revision and
not gclient_utils.IsDateRevision(options.revision)):
assert self.parent and self.parent.used_scm
@@ -636,7 +636,6 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
if options.verbose:
print('Using parent\'s revision date %s since we are in a '
'different repository.' % options.revision)
- revision_overrides[self.name] = options.revision
# Arguments number differs from overridden method
# pylint: disable=W0221
@@ -667,9 +666,10 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
else:
# Create a shallow copy to mutate revision.
options = copy.copy(options)
- options.revision = revision_overrides.get(self.name)
+ options.revision = revision_overrides.pop(self.name, None)
self.maybeGetParentRevision(
- command, options, parsed_url, self.parent.name, revision_overrides)
+ command, options, parsed_url, self.parent)
+ self._used_revision = options.revision
self._used_scm = gclient_scm.CreateSCM(
parsed_url, self.root.root_dir, self.name, self.outbuf,
out_cb=work_queue.out_cb)
@@ -1218,13 +1218,8 @@ want to set 'managed': False in .gclient.
if not '@' in revision:
# Support for --revision 123
revision = '%s@%s' % (solutions_names[index], revision)
- sol, rev = revision.split('@', 1)
- if not sol in solutions_names:
- #raise gclient_utils.Error('%s is not a valid solution.' % sol)
- print >> sys.stderr, ('Please fix your script, having invalid '
- '--revision flags will soon considered an error.')
- else:
- revision_overrides[sol] = rev
+ name, rev = revision.split('@', 1)
+ revision_overrides[name] = rev
index += 1
return revision_overrides
@@ -1278,6 +1273,9 @@ want to set 'managed': False in .gclient.
for s in self.dependencies:
work_queue.enqueue(s)
work_queue.flush(revision_overrides, command, args, options=self._options)
+ if revision_overrides:
+ print >> sys.stderr, ('Please fix your script, having invalid '
+ '--revision flags will soon considered an error.')
# Once all the dependencies have been processed, it's now safe to run the
# hooks.
« 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