Chromium Code Reviews| Index: gclient.py |
| diff --git a/gclient.py b/gclient.py |
| index 40a5e0d76b69b1848e0fc15ee83db90e40c9260d..53b419d7d1a030bd78a9390786032cc98a0b4ca7 100644 |
| --- a/gclient.py |
| +++ b/gclient.py |
| @@ -1261,8 +1261,32 @@ def CMDfetch(parser, args): |
| Completely git-specific. Simply runs 'git fetch [args ...]' for each module. |
| """ |
| (options, args) = parser.parse_args(args) |
| - args = ['-j%d' % options.jobs, '-s', 'git', 'git', 'fetch'] + args |
| - return CMDrecurse(parser, args) |
| + return CMDrecurse(Parser(), [ |
| + '--jobs=%d' % options.jobs, '--scm=git', 'git', 'fetch'] + args) |
| + |
| + |
| +def CMDgrep(parser, args): |
| + """Greps through git repos managed by gclient. |
| + |
| +Runs 'git grep [args...]' for each module. |
| +""" |
| + if not args: |
| + print 'Usage [-j <N>] git-grep args...' |
|
M-A Ruel
2012/11/05 17:39:05
print >> sys.stderr, 'Usage: git cl grep [-j <N>]
Isaac (away)
2012/11/07 07:13:53
Done.
|
| + return 1 |
| + |
| + # We can't use optparse because it will try to parse arguments sent |
|
M-A Ruel
2012/11/05 13:51:14
You can, you need to use parser.disable_interspers
Isaac (away)
2012/11/05 17:09:53
That does not allow users to pass arguments to git
M-A Ruel
2012/11/05 17:39:05
Ok, I always used -- naturally but I agree it's us
Isaac (away)
2012/11/07 07:13:53
SG. Some git commands also use -- so prefer not t
|
| + # to git grep and throw an error. :-( |
| + if re.match(r'-j\d+|--jobs=\d+', args[0]): |
| + jobs_arg, args = args[:1], args[1:] |
| + elif re.match(r'-j|--jobs', args[0]): |
| + jobs_arg, args = args[:2], args[2:] |
| + else: |
| + jobs_arg = ['--jobs=1'] |
| + |
|
M-A Ruel
2012/11/05 17:39:05
You also lose support for -h and --help. But it's
Isaac (away)
2012/11/07 07:13:53
I fixed this w/ a regex -- see new review.
|
| + return CMDrecurse( |
| + parser, |
| + jobs_arg + ['--ignore', '--scm=git', 'git', 'grep', '--color=Always'] |
| + + args) |
| @attr('usage', '[url] [safesync url]') |