patman: Implement the patchwork subcommand
Add a command to allow setting and getting the patchwork project. This
is needed so that patman can use the correct ID when talking to the
patchwork server.
To support testing, allow passing in the test database, patchwork
object and Cseries object. Fake versions can then easily be provided for
certain test cases.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/tools/patman/cmdline.py b/tools/patman/cmdline.py
index 1b2a32c..5943aa7 100644
--- a/tools/patman/cmdline.py
+++ b/tools/patman/cmdline.py
@@ -116,6 +116,29 @@
help='Show comments from each patch')
+def add_patchwork_subparser(subparsers):
+ """Add the 'patchwork' subparser
+
+ Args:
+ subparsers (argparse action): Subparser parent
+
+ Return:
+ ArgumentParser: patchwork subparser
+ """
+ patchwork = subparsers.add_parser(
+ 'patchwork',
+ help='Manage patchwork connection')
+ patchwork.defaults_cmds = [
+ ['set-project', 'U-Boot'],
+ ]
+ patchwork_subparsers = patchwork.add_subparsers(dest='subcmd')
+ patchwork_subparsers.add_parser('get-project')
+ uset = patchwork_subparsers.add_parser('set-project')
+ uset.add_argument(
+ 'project_name', help="Patchwork project name, e.g. 'U-Boot'")
+ return patchwork
+
+
def add_send_subparser(subparsers):
"""Add the 'send' subparser
@@ -201,6 +224,7 @@
subparsers = parser.add_subparsers(dest='cmd')
add_send_subparser(subparsers)
+ patchwork = add_patchwork_subparser(subparsers)
add_status_subparser(subparsers)
# Only add the 'test' action if the test data files are available.
@@ -211,6 +235,7 @@
parsers = {
'main': parser,
+ 'patchwork': patchwork,
}
return parsers