Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1242 | 1242 |
| 1243 @attr('usage', '[args ...]') | 1243 @attr('usage', '[args ...]') |
| 1244 def CMDfetch(parser, args): | 1244 def CMDfetch(parser, args): |
| 1245 """Fetches upstream commits for all modules. | 1245 """Fetches upstream commits for all modules. |
| 1246 | 1246 |
| 1247 Completely git-specific. Simply runs 'git fetch [args ...]' for each module. | 1247 Completely git-specific. Simply runs 'git fetch [args ...]' for each module. |
| 1248 """ | 1248 """ |
| 1249 (options, args) = parser.parse_args(args) | 1249 (options, args) = parser.parse_args(args) |
| 1250 args = ['-j%d' % options.jobs, '-s', 'git', 'git', 'fetch'] + args | 1250 args = ['-j%d' % options.jobs, '-s', 'git', 'git', 'fetch'] + args |
| 1251 return CMDrecurse(parser, args) | 1251 return CMDrecurse(parser, args) |
| 1252 | 1252 |
|
M-A Ruel
2012/10/26 12:45:42
2 lines
Isaac (away)
2012/11/05 07:08:49
Done.
| |
| 1253 @attr('usage', '[args ...]') | |
| 1254 def CMDgrep(parser, args): | |
| 1255 """Greps through git repos managed by gclient. | |
| 1256 | |
| 1257 Runs 'git grep [args ...]' for each module. | |
| 1258 """ | |
| 1259 parser.disable_interspersed_args() | |
| 1260 parser.set_defaults(jobs=1) | |
|
M-A Ruel
2012/10/26 12:45:42
I think it'd be preferable to remove the option wi
Isaac (away)
2012/11/05 07:08:49
I'd like to leave this option available in some fo
| |
| 1261 parser.add_option('--color', default='Always', | |
| 1262 help='--color param passed to git grep, default=Always') | |
| 1263 (options, args) = parser.parse_args(args) | |
| 1264 print 'jobs', options.jobs | |
| 1265 args = ['-j%d' % options.jobs, '-i', '-s', 'git', 'git', 'grep', | |
|
M-A Ruel
2012/10/26 12:45:42
'-jobs', '1', '--ignore', '--scm', 'git', ...
Can
Isaac (away)
2012/11/05 07:08:49
Done. I was copying CMDfetch from above. I've up
| |
| 1266 '--color=%s' % options.color] + args | |
| 1267 return CMDrecurse(parser, args) | |
| 1268 | |
| 1253 | 1269 |
| 1254 @attr('usage', '[url] [safesync url]') | 1270 @attr('usage', '[url] [safesync url]') |
| 1255 def CMDconfig(parser, args): | 1271 def CMDconfig(parser, args): |
| 1256 """Create a .gclient file in the current directory. | 1272 """Create a .gclient file in the current directory. |
| 1257 | 1273 |
| 1258 This specifies the configuration for further commands. After update/sync, | 1274 This specifies the configuration for further commands. After update/sync, |
| 1259 top-level DEPS files in each module are read to determine dependent | 1275 top-level DEPS files in each module are read to determine dependent |
| 1260 modules to operate on as well. If optional [url] parameter is | 1276 modules to operate on as well. If optional [url] parameter is |
| 1261 provided, then configuration is read from a specified Subversion server | 1277 provided, then configuration is read from a specified Subversion server |
| 1262 URL. | 1278 URL. |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1564 """Returns the default parser.""" | 1580 """Returns the default parser.""" |
| 1565 parser = optparse.OptionParser(version='%prog ' + __version__) | 1581 parser = optparse.OptionParser(version='%prog ' + __version__) |
| 1566 # some arm boards have issues with parallel sync. | 1582 # some arm boards have issues with parallel sync. |
| 1567 if platform.machine().startswith('arm'): | 1583 if platform.machine().startswith('arm'): |
| 1568 jobs = 1 | 1584 jobs = 1 |
| 1569 else: | 1585 else: |
| 1570 jobs = max(8, gclient_utils.NumLocalCpus()) | 1586 jobs = max(8, gclient_utils.NumLocalCpus()) |
| 1571 gclientfile_default = os.environ.get('GCLIENT_FILE', '.gclient') | 1587 gclientfile_default = os.environ.get('GCLIENT_FILE', '.gclient') |
| 1572 parser.add_option('-j', '--jobs', default=jobs, type='int', | 1588 parser.add_option('-j', '--jobs', default=jobs, type='int', |
| 1573 help='Specify how many SCM commands can run in parallel; ' | 1589 help='Specify how many SCM commands can run in parallel; ' |
| 1574 'defaults to number of cpu cores (%default)') | 1590 'default=%default') |
|
M-A Ruel
2012/10/26 12:45:42
Don't change here.
Isaac (away)
2012/11/05 07:08:49
Done.
| |
| 1575 parser.add_option('-v', '--verbose', action='count', default=0, | 1591 parser.add_option('-v', '--verbose', action='count', default=0, |
| 1576 help='Produces additional output for diagnostics. Can be ' | 1592 help='Produces additional output for diagnostics. Can be ' |
| 1577 'used up to three times for more logging info.') | 1593 'used up to three times for more logging info.') |
| 1578 parser.add_option('--gclientfile', dest='config_filename', | 1594 parser.add_option('--gclientfile', dest='config_filename', |
| 1579 default=None, | 1595 default=None, |
| 1580 help='Specify an alternate %s file' % gclientfile_default) | 1596 help='Specify an alternate %s file' % gclientfile_default) |
| 1581 parser.add_option('--spec', | 1597 parser.add_option('--spec', |
| 1582 default=None, | 1598 default=None, |
| 1583 help='create a gclient file containing the provided ' | 1599 help='create a gclient file containing the provided ' |
| 1584 'string. Due to Cygwin/Python brokenness, it ' | 1600 'string. Due to Cygwin/Python brokenness, it ' |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1659 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1675 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
| 1660 print >> sys.stderr, 'Error: %s' % str(e) | 1676 print >> sys.stderr, 'Error: %s' % str(e) |
| 1661 return 1 | 1677 return 1 |
| 1662 | 1678 |
| 1663 | 1679 |
| 1664 if '__main__' == __name__: | 1680 if '__main__' == __name__: |
| 1665 fix_encoding.fix_encoding() | 1681 fix_encoding.fix_encoding() |
| 1666 sys.exit(Main(sys.argv[1:])) | 1682 sys.exit(Main(sys.argv[1:])) |
| 1667 | 1683 |
| 1668 # vim: ts=2:sw=2:tw=80:et: | 1684 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |