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 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1159 env['GCLIENT_SCM'] = scm | 1159 env['GCLIENT_SCM'] = scm |
1160 if url: | 1160 if url: |
1161 env['GCLIENT_URL'] = url | 1161 env['GCLIENT_URL'] = url |
1162 if os.path.isdir(cwd): | 1162 if os.path.isdir(cwd): |
1163 subprocess2.call(args, cwd=cwd, env=env) | 1163 subprocess2.call(args, cwd=cwd, env=env) |
1164 else: | 1164 else: |
1165 print >> sys.stderr, 'Skipped missing %s' % cwd | 1165 print >> sys.stderr, 'Skipped missing %s' % cwd |
1166 return 0 | 1166 return 0 |
1167 | 1167 |
1168 | 1168 |
1169 def CMDfetch(parser, args): | |
1170 """Fetches upstream commits for all modules. | |
1171 | |
1172 Completely git-specific. Simply runs 'git fetch origin' for each module. | |
1173 """ | |
1174 parser.remove_option('--jobs') | |
M-A Ruel
2012/02/27 16:52:48
It's useful and safe to do them in parallel. I'd k
| |
1175 (options, parsed_args) = parser.parse_args(args) | |
M-A Ruel
2012/02/27 16:52:48
Why parse the arguments here? Just forward the mod
| |
1176 if parsed_args: | |
1177 print >> sys.stderr, 'Fetch accepts no arguments!' | |
1178 return 1 | |
1179 args.extend('-s git git fetch origin'.split(' ')) | |
M-A Ruel
2012/02/27 16:52:48
Let's do
args = ['-s', 'git', 'git', 'fetch'] + ar
| |
1180 # Add jobs option back, so CMDrecurse doesn't freak. | |
1181 parser.add_option('--jobs') | |
1182 return CMDrecurse(parser, args) | |
1183 | |
1184 | |
1169 @attr('usage', '[url] [safesync url]') | 1185 @attr('usage', '[url] [safesync url]') |
1170 def CMDconfig(parser, args): | 1186 def CMDconfig(parser, args): |
1171 """Create a .gclient file in the current directory. | 1187 """Create a .gclient file in the current directory. |
1172 | 1188 |
1173 This specifies the configuration for further commands. After update/sync, | 1189 This specifies the configuration for further commands. After update/sync, |
1174 top-level DEPS files in each module are read to determine dependent | 1190 top-level DEPS files in each module are read to determine dependent |
1175 modules to operate on as well. If optional [url] parameter is | 1191 modules to operate on as well. If optional [url] parameter is |
1176 provided, then configuration is read from a specified Subversion server | 1192 provided, then configuration is read from a specified Subversion server |
1177 URL. | 1193 URL. |
1178 """ | 1194 """ |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1538 except (gclient_utils.Error, subprocess2.CalledProcessError), e: | 1554 except (gclient_utils.Error, subprocess2.CalledProcessError), e: |
1539 print >> sys.stderr, 'Error: %s' % str(e) | 1555 print >> sys.stderr, 'Error: %s' % str(e) |
1540 return 1 | 1556 return 1 |
1541 | 1557 |
1542 | 1558 |
1543 if '__main__' == __name__: | 1559 if '__main__' == __name__: |
1544 fix_encoding.fix_encoding() | 1560 fix_encoding.fix_encoding() |
1545 sys.exit(Main(sys.argv[1:])) | 1561 sys.exit(Main(sys.argv[1:])) |
1546 | 1562 |
1547 # vim: ts=2:sw=2:tw=80:et: | 1563 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |