[PATCH] pwclient: add support for archiving and unarchiving patches in update

Jani Nikula jani.nikula at intel.com
Fri Mar 13 01:33:27 AEDT 2015


Add -a, --archive and -u, --unarchive options to update subcommand to
allow archiving and unarchiving the patches.

Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 apps/patchwork/bin/pwclient | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/apps/patchwork/bin/pwclient b/apps/patchwork/bin/pwclient
index 7c28f0810f4d..56fc39b8c3db 100755
--- a/apps/patchwork/bin/pwclient
+++ b/apps/patchwork/bin/pwclient
@@ -276,7 +276,7 @@ def action_apply(rpc, patch_id, apply_cmd=None):
         sys.stderr.write("Error: No patch content found\n")
         sys.exit(1)
 
-def action_update_patch(rpc, patch_id, state = None, commit = None):
+def action_update_patch(rpc, patch_id, state = None, commit = None, archived=None):
     patch = rpc.patch_get(patch_id)
     if patch == {}:
         sys.stderr.write("Error getting information on patch ID %d\n" % \
@@ -295,6 +295,9 @@ def action_update_patch(rpc, patch_id, state = None, commit = None):
     if commit:
         params['commit_ref'] = commit
 
+    if archived != None:
+        params['archived'] = archived
+
     success = False
     try:
         success = rpc.patch_set(patch_id, params)
@@ -484,6 +487,20 @@ def main():
         required=True,
         help='''Set patch state (e.g., 'Accepted', 'Superseded' etc.)'''
     )
+    update_parser.add_argument(
+        '-a', '--archive',
+        action='store_true',
+        dest='archived',
+        default=None,
+        help='''Archive patch'''
+    )
+    update_parser.add_argument(
+        '-u', '--unarchive',
+        action='store_false',
+        dest='archived',
+        default=None,
+        help='''Unarchive patch'''
+    )
     update_parser.set_defaults(subcmd='update')
     list_parser = subparsers.add_parser("list",
         add_help=False,
@@ -693,9 +710,10 @@ def main():
             action_apply(rpc, patch_id, cmd)
 
     elif action == 'update':
+        archived = args.get('archived')
         for patch_id in non_empty(h, patch_ids):
             action_update_patch(rpc, patch_id, state = state_str,
-                commit = commit_str
+                commit = commit_str, archived = archived
             )
 
     else:
-- 
2.1.4



More information about the Patchwork mailing list