maintainers: add command to retrieve reviewers only
Add a subcommand which only retrieves the 'reviewers' portion
of the refspec annotation instead of performing a full push.
This subcommand can be used in workflows which do not already use
the 'obmc-gerrit' tool to push by `$(obmc-gerrit reviewers)`.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I0ce961b45997093f5a3074d40ab594d340dd1310
diff --git a/maintainers/obmc-gerrit b/maintainers/obmc-gerrit
index 82939e8..db6bcfe 100755
--- a/maintainers/obmc-gerrit
+++ b/maintainers/obmc-gerrit
@@ -80,14 +80,23 @@
)
+def do_reviewers(args: argparse.Namespace) -> None:
+ (maintainers, reviewers) = get_reviewers()
+ print(gerrit_refspec_args(maintainers, reviewers))
+
+
parser = argparse.ArgumentParser()
subbies = parser.add_subparsers(dest="subcommand")
subbies.required = True
+
push = subbies.add_parser("push", help="Push changes to Gerrit with reviewers")
push.add_argument("remote")
push.add_argument("refspec")
push.add_argument("topic", nargs="?", default=None)
push.set_defaults(func=do_push)
+reviewers = subbies.add_parser("reviewers", help="Get the reviewer list.")
+reviewers.set_defaults(func=do_reviewers)
+
args = parser.parse_args()
args.func(args)