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

Side by Side Diff: gclient.py

Issue 3336015: Add the infrastructure necessary to support annotated stdout. (Closed)
Patch Set: add progress.update() Created 10 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | gclient_utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Meta checkout manager supporting both Subversion and GIT. 6 """Meta checkout manager supporting both Subversion and GIT.
7 7
8 Files 8 Files
9 .gclient : Current client configuration, written by 'config' command. 9 .gclient : Current client configuration, written by 'config' command.
10 Format is a Python script defining 'solutions', a list whose 10 Format is a Python script defining 'solutions', a list whose
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 #should_process = False 327 #should_process = False
328 continue 328 continue
329 else: 329 else:
330 raise gclient_utils.Error( 330 raise gclient_utils.Error(
331 'Dependency %s specified more than once:\n %s\nvs\n %s' % 331 'Dependency %s specified more than once:\n %s\nvs\n %s' %
332 (name, tree[name].hierarchy(), self.hierarchy())) 332 (name, tree[name].hierarchy(), self.hierarchy()))
333 self.dependencies.append(Dependency(self, name, url, None, None, None, 333 self.dependencies.append(Dependency(self, name, url, None, None, None,
334 None, should_process)) 334 None, should_process))
335 logging.debug('Loaded: %s' % str(self)) 335 logging.debug('Loaded: %s' % str(self))
336 336
337 def run(self, options, revision_overrides, command, args, work_queue): 337 def run(self, revision_overrides, command, args, work_queue, options):
338 """Runs 'command' before parsing the DEPS in case it's a initial checkout 338 """Runs 'command' before parsing the DEPS in case it's a initial checkout
339 or a revert.""" 339 or a revert."""
340 assert self._file_list == [] 340 assert self._file_list == []
341 if not self.should_process: 341 if not self.should_process:
342 return 342 return
343 # When running runhooks, there's no need to consult the SCM. 343 # When running runhooks, there's no need to consult the SCM.
344 # All known hooks are expected to run unconditionally regardless of working 344 # All known hooks are expected to run unconditionally regardless of working
345 # copy state, so skip the SCM status check. 345 # copy state, so skip the SCM status check.
346 run_scm = command not in ('runhooks', None) 346 run_scm = command not in ('runhooks', None)
347 self.parsed_url = self.LateOverride(self.url) 347 self.parsed_url = self.LateOverride(self.url)
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 """ 713 """
714 if not self.dependencies: 714 if not self.dependencies:
715 raise gclient_utils.Error('No solution specified') 715 raise gclient_utils.Error('No solution specified')
716 revision_overrides = self._EnforceRevisions() 716 revision_overrides = self._EnforceRevisions()
717 pm = None 717 pm = None
718 if command == 'update' and not self._options.verbose: 718 if command == 'update' and not self._options.verbose:
719 pm = Progress('Syncing projects', 1) 719 pm = Progress('Syncing projects', 1)
720 work_queue = gclient_utils.ExecutionQueue(self._options.jobs, pm) 720 work_queue = gclient_utils.ExecutionQueue(self._options.jobs, pm)
721 for s in self.dependencies: 721 for s in self.dependencies:
722 work_queue.enqueue(s) 722 work_queue.enqueue(s)
723 work_queue.flush(self._options, revision_overrides, command, args, 723 work_queue.flush(revision_overrides, command, args, options=self._options)
724 work_queue)
725 724
726 # Once all the dependencies have been processed, it's now safe to run the 725 # Once all the dependencies have been processed, it's now safe to run the
727 # hooks. 726 # hooks.
728 if not self._options.nohooks: 727 if not self._options.nohooks:
729 self.RunHooksRecursively(self._options) 728 self.RunHooksRecursively(self._options)
730 729
731 if command == 'update': 730 if command == 'update':
732 # Notify the user if there is an orphaned entry in their working copy. 731 # Notify the user if there is an orphaned entry in their working copy.
733 # Only delete the directory if there are no changes in it, and 732 # Only delete the directory if there are no changes in it, and
734 # delete_unversioned_trees is set to true. 733 # delete_unversioned_trees is set to true.
(...skipping 23 matching lines...) Expand all
758 self._SaveEntries() 757 self._SaveEntries()
759 return 0 758 return 0
760 759
761 def PrintRevInfo(self): 760 def PrintRevInfo(self):
762 if not self.dependencies: 761 if not self.dependencies:
763 raise gclient_utils.Error('No solution specified') 762 raise gclient_utils.Error('No solution specified')
764 # Load all the settings. 763 # Load all the settings.
765 work_queue = gclient_utils.ExecutionQueue(self._options.jobs, None) 764 work_queue = gclient_utils.ExecutionQueue(self._options.jobs, None)
766 for s in self.dependencies: 765 for s in self.dependencies:
767 work_queue.enqueue(s) 766 work_queue.enqueue(s)
768 work_queue.flush(self._options, {}, None, [], work_queue) 767 work_queue.flush({}, None, [], options=self._options)
769 768
770 def GetURLAndRev(dep): 769 def GetURLAndRev(dep):
771 """Returns the revision-qualified SCM url for a Dependency.""" 770 """Returns the revision-qualified SCM url for a Dependency."""
772 if dep.parsed_url is None: 771 if dep.parsed_url is None:
773 return None 772 return None
774 if isinstance(dep.parsed_url, self.FileImpl): 773 if isinstance(dep.parsed_url, self.FileImpl):
775 original_url = dep.parsed_url.file_location 774 original_url = dep.parsed_url.file_location
776 else: 775 else:
777 original_url = dep.parsed_url 776 original_url = dep.parsed_url
778 url, _ = gclient_utils.SplitUrlRevision(original_url) 777 url, _ = gclient_utils.SplitUrlRevision(original_url)
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 return CMDhelp(parser, argv) 1228 return CMDhelp(parser, argv)
1230 except gclient_utils.Error, e: 1229 except gclient_utils.Error, e:
1231 print >> sys.stderr, 'Error: %s' % str(e) 1230 print >> sys.stderr, 'Error: %s' % str(e)
1232 return 1 1231 return 1
1233 1232
1234 1233
1235 if '__main__' == __name__: 1234 if '__main__' == __name__:
1236 sys.exit(Main(sys.argv[1:])) 1235 sys.exit(Main(sys.argv[1:]))
1237 1236
1238 # vim: ts=2:sw=2:tw=80:et: 1237 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | gclient_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698