OLD | NEW |
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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 #should_process = False | 325 #should_process = False |
326 continue | 326 continue |
327 else: | 327 else: |
328 raise gclient_utils.Error( | 328 raise gclient_utils.Error( |
329 'Dependency %s specified more than once:\n %s\nvs\n %s' % | 329 'Dependency %s specified more than once:\n %s\nvs\n %s' % |
330 (name, tree[name].hierarchy(), self.hierarchy())) | 330 (name, tree[name].hierarchy(), self.hierarchy())) |
331 self.dependencies.append(Dependency(self, name, url, None, None, None, | 331 self.dependencies.append(Dependency(self, name, url, None, None, None, |
332 None, should_process)) | 332 None, should_process)) |
333 logging.debug('Loaded: %s' % str(self)) | 333 logging.debug('Loaded: %s' % str(self)) |
334 | 334 |
| 335 # Arguments number differs from overridden method |
| 336 # pylint: disable=W0221 |
335 def run(self, revision_overrides, command, args, work_queue, options): | 337 def run(self, revision_overrides, command, args, work_queue, options): |
336 """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 |
337 or a revert.""" | 339 or a revert.""" |
338 assert self._file_list == [] | 340 assert self._file_list == [] |
339 if not self.should_process: | 341 if not self.should_process: |
340 return | 342 return |
341 # When running runhooks, there's no need to consult the SCM. | 343 # When running runhooks, there's no need to consult the SCM. |
342 # All known hooks are expected to run unconditionally regardless of working | 344 # All known hooks are expected to run unconditionally regardless of working |
343 # copy state, so skip the SCM status check. | 345 # copy state, so skip the SCM status check. |
344 run_scm = command not in ('runhooks', None) | 346 run_scm = command not in ('runhooks', None) |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 def Main(argv): | 1185 def Main(argv): |
1184 """Doesn't parse the arguments here, just find the right subcommand to | 1186 """Doesn't parse the arguments here, just find the right subcommand to |
1185 execute.""" | 1187 execute.""" |
1186 try: | 1188 try: |
1187 # Make stdout auto-flush so buildbot doesn't kill us during lengthy | 1189 # Make stdout auto-flush so buildbot doesn't kill us during lengthy |
1188 # operations. Python as a strong tendency to buffer sys.stdout. | 1190 # operations. Python as a strong tendency to buffer sys.stdout. |
1189 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) | 1191 sys.stdout = gclient_utils.MakeFileAutoFlush(sys.stdout) |
1190 # Make stdout annotated with the thread ids. | 1192 # Make stdout annotated with the thread ids. |
1191 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout) | 1193 sys.stdout = gclient_utils.MakeFileAnnotated(sys.stdout) |
1192 # Do it late so all commands are listed. | 1194 # Do it late so all commands are listed. |
| 1195 # Unused variable 'usage' |
| 1196 # pylint: disable=W0612 |
1193 CMDhelp.usage = ('\n\nCommands are:\n' + '\n'.join([ | 1197 CMDhelp.usage = ('\n\nCommands are:\n' + '\n'.join([ |
1194 ' %-10s %s' % (fn[3:], Command(fn[3:]).__doc__.split('\n')[0].strip()) | 1198 ' %-10s %s' % (fn[3:], Command(fn[3:]).__doc__.split('\n')[0].strip()) |
1195 for fn in dir(sys.modules[__name__]) if fn.startswith('CMD')])) | 1199 for fn in dir(sys.modules[__name__]) if fn.startswith('CMD')])) |
1196 parser = optparse.OptionParser(version='%prog ' + __version__) | 1200 parser = optparse.OptionParser(version='%prog ' + __version__) |
1197 parser.add_option('-j', '--jobs', default=1, type='int', | 1201 parser.add_option('-j', '--jobs', default=1, type='int', |
1198 help='Specify how many SCM commands can run in parallel; ' | 1202 help='Specify how many SCM commands can run in parallel; ' |
1199 'default=%default') | 1203 'default=%default') |
1200 parser.add_option('-v', '--verbose', action='count', default=0, | 1204 parser.add_option('-v', '--verbose', action='count', default=0, |
1201 help='Produces additional output for diagnostics. Can be ' | 1205 help='Produces additional output for diagnostics. Can be ' |
1202 'used up to three times for more logging info.') | 1206 'used up to three times for more logging info.') |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 return CMDhelp(parser, argv) | 1251 return CMDhelp(parser, argv) |
1248 except gclient_utils.Error, e: | 1252 except gclient_utils.Error, e: |
1249 print >> sys.stderr, 'Error: %s' % str(e) | 1253 print >> sys.stderr, 'Error: %s' % str(e) |
1250 return 1 | 1254 return 1 |
1251 | 1255 |
1252 | 1256 |
1253 if '__main__' == __name__: | 1257 if '__main__' == __name__: |
1254 sys.exit(Main(sys.argv[1:])) | 1258 sys.exit(Main(sys.argv[1:])) |
1255 | 1259 |
1256 # vim: ts=2:sw=2:tw=80:et: | 1260 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |