fromupstream: Support multiple bug lines
If we add multiple -b params to the command only one is processed.
We also take this chance to unify the way we handle the bugs
BUG=None
TEST=fromupstream.py upstream://abcde --test="None" --bug="b:123, b:123, b:123, b:123, b:123, b:123, b:123, b:123, b:123, b:123, b:123, b:123, b:123, b:123, b:123, b:123, b:123, b:123, b:123, b:123, b:123" --crbug=56 --crbug=67
Change-Id: I4f453e050d8b14a485eea40b7ae2ff1418bafd00
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2629555
Tested-by: Ricardo Ribalda <ribalda@chromium.org>
Commit-Queue: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Auto-Submit: Ricardo Ribalda <ribalda@chromium.org>
diff --git a/contrib/fromupstream.py b/contrib/fromupstream.py
index d48d436..38568b7 100755
--- a/contrib/fromupstream.py
+++ b/contrib/fromupstream.py
@@ -427,13 +427,13 @@
"""
parser = argparse.ArgumentParser()
- parser.add_argument('--bug', '-b',
+ parser.add_argument('--bug', '-b', action='append', default=[],
type=str, help='BUG= line')
parser.add_argument('--test', '-t', action='append', default=[],
type=str, help='TEST= line')
- parser.add_argument('--crbug', action='append',
+ parser.add_argument('--crbug', action='append', default=[],
type=int, help='BUG=chromium: line')
- parser.add_argument('--buganizer', action='append',
+ parser.add_argument('--buganizer', action='append', default=[],
type=int, help='BUG=b: line')
parser.add_argument('--changeid', '-c',
help='Overrides the gerrit generated Change-Id line')
@@ -474,18 +474,12 @@
cq_depends = [args['cqdepend']] if args['cqdepend'] else []
- bug_lines = []
- if args['bug']:
- # un-wrap intentionally
- bug_lines += [args['bug']]
- if args['buganizer']:
- buganizers = ', '.join('b:%d' % x for x in args['buganizer'])
- bug_lines += [x.strip(' ,') for x in
- _wrap_commit_line('BUG=', buganizers).split('\n')]
- if args['crbug']:
- crbugs = ', '.join('chromium:%d' % x for x in args['crbug'])
- bug_lines += [x.strip(' ,') for x in
- _wrap_commit_line('BUG=', crbugs).split('\n')]
+ bugs = args['bug']
+ bugs += ['b:%d' % x for x in args['buganizer']]
+ bugs += ['chromium:%d' % x for x in args['crbug']]
+ bugs = ', '.join(bugs)
+ bug_lines = [x.strip(' ,') for x in
+ _wrap_commit_line('BUG=', bugs).split('\n')]
test_lines = [_wrap_commit_line('TEST=', x) for x in args['test']]