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 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 def CMDrecurse(parser, args): | 871 def CMDrecurse(parser, args): |
872 """Operates on all the entries. | 872 """Operates on all the entries. |
873 | 873 |
874 Runs a shell command on all entries. | 874 Runs a shell command on all entries. |
875 """ | 875 """ |
876 # Stop parsing at the first non-arg so that these go through to the command | 876 # Stop parsing at the first non-arg so that these go through to the command |
877 parser.disable_interspersed_args() | 877 parser.disable_interspersed_args() |
878 parser.add_option('-s', '--scm', action='append', default=[], | 878 parser.add_option('-s', '--scm', action='append', default=[], |
879 help='choose scm types to operate upon') | 879 help='choose scm types to operate upon') |
880 options, args = parser.parse_args(args) | 880 options, args = parser.parse_args(args) |
881 root, entries = gclient_utils.GetGClientRootAndEntries() | 881 root_and_entries = gclient_utils.GetGClientRootAndEntries() |
| 882 if not root_and_entries: |
| 883 print >> sys.stderr, ( |
| 884 'You need to run gclient sync at least once to use \'recurse\'.\n' |
| 885 'This is because .gclient_entries needs to exist and be up to date.') |
| 886 return 1 |
| 887 root, entries = root_and_entries |
882 scm_set = set() | 888 scm_set = set() |
883 for scm in options.scm: | 889 for scm in options.scm: |
884 scm_set.update(scm.split(',')) | 890 scm_set.update(scm.split(',')) |
885 | 891 |
886 # Pass in the SCM type as an env variable | 892 # Pass in the SCM type as an env variable |
887 env = os.environ.copy() | 893 env = os.environ.copy() |
888 | 894 |
889 for path, url in entries.iteritems(): | 895 for path, url in entries.iteritems(): |
890 scm = gclient_scm.GetScmName(url) | 896 scm = gclient_scm.GetScmName(url) |
891 if scm_set and scm not in scm_set: | 897 if scm_set and scm not in scm_set: |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 return CMDhelp(parser, argv) | 1246 return CMDhelp(parser, argv) |
1241 except gclient_utils.Error, e: | 1247 except gclient_utils.Error, e: |
1242 print >> sys.stderr, 'Error: %s' % str(e) | 1248 print >> sys.stderr, 'Error: %s' % str(e) |
1243 return 1 | 1249 return 1 |
1244 | 1250 |
1245 | 1251 |
1246 if '__main__' == __name__: | 1252 if '__main__' == __name__: |
1247 sys.exit(Main(sys.argv[1:])) | 1253 sys.exit(Main(sys.argv[1:])) |
1248 | 1254 |
1249 # vim: ts=2:sw=2:tw=80:et: | 1255 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |