Commit d05e5fb0 authored by rdsmith@google.com's avatar rdsmith@google.com

'git try': a) Give users help when they ask for it, b) Don't start try job if...

'git try': a) Give users help when they ask for it, b) Don't start try job if you don't understand the command.

BUG=none
TEST=Make change in local sandbox and confirm proper things happen on "git try help", "git try xyzzy", and "git try -b linux."

Review URL: http://codereview.chromium.org/3075009

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@54374 0039d316-1c4b-4281-b951-d872f2087c98
parent a44ff7ee
......@@ -600,8 +600,24 @@ def TryChange(argv,
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.
# 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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment