Commit 5a368d4d authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Make git cl issue handle bad arguments more gracefully.

Running "git cl issue -r invalid_input" will now produce an error
message and continue, instead of crashing with a stacktrace.

Change-Id: I17626a513df904a1a3ff725ec7a17e8541db6bf8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1538978Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
parent fef79d40
......@@ -4142,11 +4142,14 @@ def CMDissue(parser, args):
args = sorted(issue_branch_map.iterkeys())
result = {}
for issue in args:
if not issue:
try:
issue_num = int(issue)
except ValueError:
print('ERROR cannot parse issue number: %s' % issue, file=sys.stderr)
continue
result[int(issue)] = issue_branch_map.get(int(issue))
result[issue_num] = issue_branch_map.get(issue_num)
print('Branch for issue number %s: %s' % (
issue, ', '.join(issue_branch_map.get(int(issue)) or ('None',))))
issue, ', '.join(issue_branch_map.get(issue_num) or ('None',))))
if options.json:
write_json(options.json, result)
return 0
......
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