Commit d3e5754b authored by bauerb@chromium.org's avatar bauerb@chromium.org

Reland 77470: Don't ignore first argument in TryChange

Original review: http://codereview.chromium.org/6650025/

BUG=none
TEST=`git try foo` gives a proper error message.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@78180 0039d316-1c4b-4281-b951-d872f2087c98
parent dc276cba
...@@ -916,11 +916,10 @@ def TryChange(change_info, args, swallow_exception): ...@@ -916,11 +916,10 @@ def TryChange(change_info, args, swallow_exception):
trychange_args.extend(["--issue", str(change_info.issue)]) trychange_args.extend(["--issue", str(change_info.issue)])
if change_info.patchset: if change_info.patchset:
trychange_args.extend(["--patchset", str(change_info.patchset)]) trychange_args.extend(["--patchset", str(change_info.patchset)])
trychange_args.extend(args)
file_list = change_info.GetFileNames() file_list = change_info.GetFileNames()
else: else:
trychange_args.extend(args)
file_list = [] file_list = []
trychange_args.extend(args)
return trychange.TryChange( return trychange.TryChange(
trychange_args, trychange_args,
file_list=file_list, file_list=file_list,
......
...@@ -330,10 +330,9 @@ def _SendChangeHTTP(options): ...@@ -330,10 +330,9 @@ def _SendChangeHTTP(options):
logging.info('Sending by HTTP') logging.info('Sending by HTTP')
logging.info(description) logging.info(description)
logging.info(url) logging.info(url)
logging.info(options.diff)
if options.dry_run: if options.dry_run:
print options.diff
return return
logging.info(options.diff)
try: try:
logging.info('Opening connection...') logging.info('Opening connection...')
...@@ -510,7 +509,8 @@ def TryChange(argv, ...@@ -510,7 +509,8 @@ def TryChange(argv,
"optional if --issue is used, In that case, the " "optional if --issue is used, In that case, the "
"latest patchset will be used.") "latest patchset will be used.")
group.add_option("--dry_run", action='store_true', group.add_option("--dry_run", action='store_true',
help="Just prints the diff and quits") help="Don't send the try job. This implies --verbose, so "
"it will print the diff.")
parser.add_option_group(group) parser.add_option_group(group)
group = optparse.OptionGroup(parser, "Try job options") group = optparse.OptionGroup(parser, "Try job options")
...@@ -611,24 +611,18 @@ def TryChange(argv, ...@@ -611,24 +611,18 @@ def TryChange(argv,
options, args = parser.parse_args(argv) options, args = parser.parse_args(argv)
# 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 they've asked for help, give it to them
if len(args) == 2 and args[1] == 'help': if len(args) == 1 and args[0] == 'help':
parser.print_help() parser.print_help()
return 0 return 0
# If they've said something confusing, don't spawn a try job until you # If they've said something confusing, don't spawn a try job until you
# understand what they want. # understand what they want.
if len(args) > 1: if args:
plural = "" parser.error('Extra argument(s) "%s" not understood' % ' '.join(args))
if len(args) > 2:
plural = "s" if options.dry_run:
print >> sys.stderr, ( options.verbose += 1
'Argument%s \"%s\" not understood' % (plural, ' '.join(args[1:])))
parser.print_help()
return 1
LOG_FORMAT = '%(levelname)s %(filename)s(%(lineno)d): %(message)s' LOG_FORMAT = '%(levelname)s %(filename)s(%(lineno)d): %(message)s'
if not swallow_exception: 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