gerrit: fix some actions after rewrite
The assign & message actions were inheriting from the wrong parent.
Add an assert to catch that in the future (rather than silently
exiting 0), and then fix the inheritance.
Also fix the order of arguments on these to match previous behavior
and to match all the other actions that take an arbitrary number of
CLs.
BUG=chromium:1063185
TEST=`gerrit message -n 1234 foo` works again
Change-Id: Idffac364dd643fe79a95f1b1028d4a66608217ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/2111893
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/gerrit.py b/scripts/gerrit.py
index a025ddd..5b4d741 100644
--- a/scripts/gerrit.py
+++ b/scripts/gerrit.py
@@ -48,6 +48,7 @@
@staticmethod
def __call__(opts):
"""Implement the action."""
+ raise RuntimeError('Internal error: action missing __call__ implementation')
# How many connections we'll use in parallel. We don't want this to be too high
@@ -622,9 +623,9 @@
@staticmethod
def init_subparser(parser):
"""Add arguments to this action's subparser."""
+ _ActionSimpleParallelCLs.init_subparser(parser)
parser.add_argument('assignee',
help='The new assignee')
- _ActionSimpleParallelCLs.init_subparser(parser)
@staticmethod
def _process_one(helper, cl, opts):
@@ -632,7 +633,7 @@
helper.SetAssignee(cl, opts.assignee, dryrun=opts.dryrun)
-class ActionMessage(UserAction):
+class ActionMessage(_ActionSimpleParallelCLs):
"""Add a message to a CL"""
COMMAND = 'message'
@@ -640,9 +641,9 @@
@staticmethod
def init_subparser(parser):
"""Add arguments to this action's subparser."""
+ _ActionSimpleParallelCLs.init_subparser(parser)
parser.add_argument('message',
help='The message to post')
- _ActionSimpleParallelCLs.init_subparser(parser)
@staticmethod
def _process_one(helper, cl, opts):
@@ -650,7 +651,7 @@
helper.SetReview(cl, msg=opts.message, dryrun=opts.dryrun)
-class ActionTopic(UserAction):
+class ActionTopic(_ActionSimpleParallelCLs):
"""Set a topic for one or more CLs"""
COMMAND = 'topic'
@@ -658,9 +659,9 @@
@staticmethod
def init_subparser(parser):
"""Add arguments to this action's subparser."""
+ _ActionSimpleParallelCLs.init_subparser(parser)
parser.add_argument('topic',
help='The topic to set')
- _ActionSimpleParallelCLs.init_subparser(parser)
@staticmethod
def _process_one(helper, cl, opts):