Chromium Code Reviews| Index: gclient.py |
| =================================================================== |
| --- gclient.py (revision 82287) |
| +++ gclient.py (working copy) |
| @@ -339,6 +339,40 @@ |
| def run(self, revision_overrides, command, args, work_queue, options): |
| """Runs 'command' before parsing the DEPS in case it's a initial checkout |
| or a revert.""" |
| + |
| + def maybeGetParentRevision(options): |
| + """If we are performing an update and --transitive is set, set the |
| + revision to the parent's revision. If we have an explicit revision |
| + do nothing.""" |
| + _, revision = gclient_utils.SplitUrlRevision(self.parsed_url) |
| + if (command == 'update' and |
| + options.transitive and |
| + revision is None and |
| + options.revision is None): |
| + options.revision = revision_overrides.get(self.parent.name) |
| + if options.verbose and options.revision is not None: |
| + print("Using parent's revision date: %s" % options.revision) |
| + # If the parent has a revision override, then it must have been |
| + # converted to date format. |
| + assert (options.revision is None or |
| + gclient_utils.IsDateRevision(options.revision)) |
| + |
| + def maybeConvertToDateRevision(options): |
| + """If we are performing an update and --transitive is set, convert the |
| + revision to a date-revision (if necessary). Instead of having |
| + -r 101 replace the revision with the date of 101 (e.g. "{2011-18-04}"). |
| + This way dependencies are upgraded to the revision they had at the |
| + check-ini of revision 101.""" |
|
M-A Ruel
2011/04/20 15:43:28
ini?
Florian Loitsch
2011/04/20 18:32:01
Done.
|
| + if (command == 'update' and |
| + options.transitive and |
| + options.revision is not None and |
| + not gclient_utils.IsDateRevision(options.revision)): |
| + date_revision = scm.GetDateRevision(options.revision) |
| + if options.verbose: |
| + print("Updating revision override from %s to %s." % |
| + (options.revision, date_revision)) |
| + revision_overrides[self.name] = date_revision |
| + |
| assert self._file_list == [] |
| if not self.should_process: |
| return |
| @@ -362,8 +396,10 @@ |
| # Create a shallow copy to mutate revision. |
| options = copy.copy(options) |
| options.revision = revision_overrides.get(self.name) |
| + maybeGetParentRevision(options) |
| scm = gclient_scm.CreateSCM(self.parsed_url, self.root_dir(), self.name) |
| scm.RunCommand(command, options, args, self._file_list) |
| + maybeConvertToDateRevision(options) |
| self._file_list = [os.path.join(self.name, f.strip()) |
| for f in self._file_list] |
| self.processed = True |
| @@ -1043,6 +1079,10 @@ |
| 'has multiple solutions configured and will work even ' |
| 'if the src@ part is skipped. Note that specifying ' |
| '--revision means your safesync_url gets ignored.') |
| + parser.add_option('-t', '--transitive', action='store_true', |
| + help='When a revision is specified (in the DEPS file or ' |
| + 'with the command-line flag), transitively update ' |
| + 'the dependencies to the date of the given revision.') |
| parser.add_option('-H', '--head', action='store_true', |
| help='skips any safesync_urls specified in ' |
| 'configured solutions and sync to head instead') |