Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Side by Side Diff: gclient.py

Issue 3779010: Return a meaningful error message when no arg is given to gclient recurse. (Closed)
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 if not args:
882 print >> sys.stderr, 'Need to supply a command!'
883 return 1
881 root_and_entries = gclient_utils.GetGClientRootAndEntries() 884 root_and_entries = gclient_utils.GetGClientRootAndEntries()
882 if not root_and_entries: 885 if not root_and_entries:
883 print >> sys.stderr, ( 886 print >> sys.stderr, (
884 'You need to run gclient sync at least once to use \'recurse\'.\n' 887 '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.') 888 'This is because .gclient_entries needs to exist and be up to date.')
886 return 1 889 return 1
887 root, entries = root_and_entries 890 root, entries = root_and_entries
888 scm_set = set() 891 scm_set = set()
889 for scm in options.scm: 892 for scm in options.scm:
890 scm_set.update(scm.split(',')) 893 scm_set.update(scm.split(','))
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 return CMDhelp(parser, argv) 1249 return CMDhelp(parser, argv)
1247 except gclient_utils.Error, e: 1250 except gclient_utils.Error, e:
1248 print >> sys.stderr, 'Error: %s' % str(e) 1251 print >> sys.stderr, 'Error: %s' % str(e)
1249 return 1 1252 return 1
1250 1253
1251 1254
1252 if '__main__' == __name__: 1255 if '__main__' == __name__:
1253 sys.exit(Main(sys.argv[1:])) 1256 sys.exit(Main(sys.argv[1:]))
1254 1257
1255 # vim: ts=2:sw=2:tw=80:et: 1258 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698