summaryrefslogtreecommitdiffstats
path: root/apps/patchwork/bin/pwclient
diff options
context:
space:
mode:
authorDoug Anderson <dianders@chromium.org>2012-12-03 14:08:17 +0000
committerJeremy Kerr <jk@ozlabs.org>2012-12-30 09:30:32 +0800
commitbfb1ddb628ed1bea06d6eba5c6cc7a1c71abf5af (patch)
treecdcf42c95df34cefa91610a849fe5e1a5e1b09fc /apps/patchwork/bin/pwclient
parent98435ac3c25410fadfae1a2e6b8a6f4c4b287da6 (diff)
downloadpatchwork-bfb1ddb628ed1bea06d6eba5c6cc7a1c71abf5af.tar.bz2
patchwork-bfb1ddb628ed1bea06d6eba5c6cc7a1c71abf5af.tar.xz
pwclient: Add command for printing patch info
This command prints raw information that patchwork has about a patch. This can be useful for debugging problems with patchwork. Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'apps/patchwork/bin/pwclient')
-rwxr-xr-xapps/patchwork/bin/pwclient16
1 files changed, 14 insertions, 2 deletions
diff --git a/apps/patchwork/bin/pwclient b/apps/patchwork/bin/pwclient
index 9588615..e642195 100755
--- a/apps/patchwork/bin/pwclient
+++ b/apps/patchwork/bin/pwclient
@@ -113,6 +113,7 @@ def usage():
""" apply <ID> : Apply a patch (in the current dir, using -p1)
git-am <ID> : Apply a patch to current git branch using "git am"
get <ID> : Download a patch and save it locally
+ info <ID> : Display patchwork info about a given patch ID
projects : List all projects
states : Show list of potential patch states
list [str] : List patches, using the optional filters specified
@@ -224,6 +225,14 @@ def action_states(rpc):
for state in states:
print("%-5d %s" % (state['id'], state['name']))
+def action_info(rpc, patch_id):
+ patch = rpc.patch_get(patch_id)
+ s = "Information for patch id %d" % (patch_id)
+ print(s)
+ print('-' * len(s))
+ for key, value in sorted(patch.iteritems()):
+ print("- %- 14s: %s" % (key, value))
+
def action_get(rpc, patch_id):
patch = rpc.patch_get(patch_id)
s = rpc.patch_get_mbox(patch_id)
@@ -443,14 +452,17 @@ def main():
if len(s) > 0:
print unicode(s).encode("utf-8")
- elif action == 'get' or action == 'save':
+ elif action in ('get', 'save', 'info'):
try:
patch_id = patch_id or int(args[0])
except:
sys.stderr.write("Invalid patch ID given\n")
sys.exit(1)
- action_get(rpc, patch_id)
+ if action == 'info':
+ action_info(rpc, patch_id)
+ else:
+ action_get(rpc, patch_id)
elif action == 'apply':
try: