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

Unified Diff: trychange.py

Issue 3075009: 'git try': a) Give users help when they ask for it, b) Don't start try job if... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trychange.py
===================================================================
--- trychange.py (revision 54207)
+++ trychange.py (working copy)
@@ -600,9 +600,25 @@
parser.add_option_group(group)
options, args = parser.parse_args(argv)
- if len(args) == 1 and args[0] == 'help':
+
+ # Note that the args array includes the script name, so
+ # a single argument results in len(args) == 2.
Evan Martin 2010/07/29 23:36:19 Wow, I have probably written the same bug a millio
+
+ # If they've asked for help, give it to them
+ if len(args) == 2 and args[1] == 'help':
parser.print_help()
+ return 0
+ # If they've said something confusing, don't spawn a try job until you
+ # understand what they want.
+ if len(args) > 1:
+ plural = ""
+ if len(args) > 2:
+ plural = "s"
+ print "Argument%s \"%s\" not understood" % (plural, " ".join(args[1:]))
+ parser.print_help()
+ return 1
+
LOG_FORMAT = '%(levelname)s %(filename)s(%(lineno)d): %(message)s'
if not swallow_exception:
if options.verbose == 0:
« 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