fromupstream: Add --buganizer and --crbug options

The BUG= line is sometimes hard to get right if you forget a b: and that
bug is in buganizer you'll most likely make an impossible link. Let's
add --crbug and --buganizer to be more explicit about the bug types and
then do the 'b:' and 'chromium:' prefix for the user. They can just
specify the right command line (possibly many times) and get a list of
bugs in their BUG line.

BUG=None
TEST=Use --crbug, --buganizer, --bug, all, none, and see if all match
expectations

Change-Id: Ibaf46f8d1878b9a802703d83cd004bdb3d87cd96
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1308314
Reviewed-by: Douglas Anderson <dianders@chromium.org>
diff --git a/contrib/fromupstream.py b/contrib/fromupstream.py
index 7c6bea1..871708f 100755
--- a/contrib/fromupstream.py
+++ b/contrib/fromupstream.py
@@ -119,6 +119,10 @@
                         type=str, help='BUG= line')
     parser.add_argument('--test', '-t',
                         type=str, help='TEST= line')
+    parser.add_argument('--crbug', action='append',
+                        type=int, help='BUG=chromium: line')
+    parser.add_argument('--buganizer', action='append',
+                        type=int, help='BUG=b: line')
     parser.add_argument('--changeid', '-c',
                         help='Overrides the gerrit generated Change-Id line')
 
@@ -147,6 +151,13 @@
 
     args = vars(parser.parse_args(args))
 
+    buglist = [args['bug']] if args['bug'] else []
+    if args['buganizer']:
+        buglist += ['b:{0}'.format(x) for x in args['buganizer']]
+    if args['crbug']:
+        buglist += ['chromium:{0}'.format(x) for x in args['crbug']]
+    args['bug'] = ', '.join(buglist)
+
     if args['replace']:
         old_commit_message = subprocess.check_output(
             ['git', 'show', '-s', '--format=%B', 'HEAD']