Chromium Code Reviews| Index: gclient.py |
| =================================================================== |
| --- gclient.py (revision 124545) |
| +++ gclient.py (working copy) |
| @@ -565,6 +565,23 @@ |
| # Strip any leading path separators. |
| while file_list[i].startswith(('\\', '/')): |
| file_list[i] = file_list[i][1:] |
| + elif command is None and args: |
| + # Used by CMDrecurse to run an arbitrary command |
| + if not isinstance(parsed_url, self.FileImpl): |
| + # Skip file only checkout. |
| + scm = gclient_scm.GetScmName(parsed_url) |
| + if not options.scm or scm in options.scm: |
| + cwd = os.path.normpath(os.path.join(self.root.root_dir, self.name)) |
| + # Pass in the SCM type as an env variable |
| + env = os.environ.copy() |
| + if scm: |
| + env['GCLIENT_SCM'] = scm |
| + if parsed_url: |
| + env['GCLIENT_URL'] = parsed_url |
| + if os.path.isdir(cwd): |
| + gclient_utils.CheckCallAndFilterAndHeader(args, cwd=cwd, env=env) |
|
davidbarr
2012/03/02 01:23:05
Now the output is handled nicely.
|
| + else: |
| + print >> sys.stderr, 'Skipped missing %s' % cwd |
| # Always parse the DEPS file. |
| self.ParseDepsFile() |
| @@ -1131,7 +1148,6 @@ |
| parser.disable_interspersed_args() |
| parser.add_option('-s', '--scm', action='append', default=[], |
| help='choose scm types to operate upon') |
| - parser.remove_option('--jobs') |
| options, args = parser.parse_args(args) |
| if not args: |
| print >> sys.stderr, 'Need to supply a command!' |
| @@ -1142,27 +1158,22 @@ |
| 'You need to run gclient sync at least once to use \'recurse\'.\n' |
| 'This is because .gclient_entries needs to exist and be up to date.') |
| return 1 |
| - root, entries = root_and_entries |
| + |
| + # Normalize options.scm to a set() |
| scm_set = set() |
| for scm in options.scm: |
| scm_set.update(scm.split(',')) |
| + options.scm = scm_set |
| - # Pass in the SCM type as an env variable |
| - env = os.environ.copy() |
| - |
| - for path, url in entries.iteritems(): |
| - scm = gclient_scm.GetScmName(url) |
| - if scm_set and scm not in scm_set: |
| - continue |
| - cwd = os.path.normpath(os.path.join(root, path)) |
| - if scm: |
| - env['GCLIENT_SCM'] = scm |
| - if url: |
| - env['GCLIENT_URL'] = url |
| - if os.path.isdir(cwd): |
| - subprocess2.call(args, cwd=cwd, env=env) |
| - else: |
| - print >> sys.stderr, 'Skipped missing %s' % cwd |
| + client = GClient.LoadCurrentConfig(options) |
| + pm = None |
|
M-A Ruel
2012/03/02 01:40:37
Replace lines 1168-1176 with:
options.nohooks = Tr
|
| + # Disable progress for non-tty stdout. |
| + if (sys.stdout.isatty() and not options.verbose): |
| + pm = Progress(' '.join(args), 1) |
| + work_queue = gclient_utils.ExecutionQueue(options.jobs, pm) |
| + for s in client.dependencies: |
| + work_queue.enqueue(s) |
| + work_queue.flush({}, None, args, options=options) |
| return 0 |
| @@ -1172,8 +1183,8 @@ |
| Completely git-specific. Simply runs 'git fetch [args ...]' for each module. |
| """ |
| - (_, args) = parser.parse_args(args) |
| - args = ['-s', 'git', 'git', 'fetch'] + args |
| + (options, args) = parser.parse_args(args) |
| + args = ['-j%d' % options.jobs, '-s', 'git', 'git', 'fetch'] + args |
|
davidbarr
2012/03/02 01:23:05
This still makes me uncomfortable, but there isn't
|
| return CMDrecurse(parser, args) |