From patchwork Tue Dec 4 00:08:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 203509 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 9A38E2C0123 for ; Tue, 4 Dec 2012 11:08:41 +1100 (EST) Received: from mail-bk0-f73.google.com (mail-bk0-f73.google.com [209.85.214.73]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 614C12C00AC for ; Tue, 4 Dec 2012 11:08:36 +1100 (EST) Received: by mail-bk0-f73.google.com with SMTP id jf3so228028bkc.2 for ; Mon, 03 Dec 2012 16:08:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=iumAyUFDTgbxruvl7stiB7m1qinrKha0LLftYghoip0=; b=HWBsoN1gWxto+YLHhjBC8iQKru/Ld98kb9Or0kslthDHiJFsFQQsL7893Kv7GEqHxF jDmbniUo2DKGvYBHpAF+Zxd09U9kiMkMuGYqJTpMfKAwPtsyq5n5apW/i5pzs0cAyDIK 9rx9MrGfaPMmCBsnLODIhNmlo6sZC8hw44tGrTpfYEAM8u0SE64hvvlMrV178Zzj81XH RU7vPiRDsW8TyWIdjpRpzoHH+/8CV7aZh/JgtwaOtwvVkyjyyeKe45zWhKjpP4Up5Fwf 63XPUFayMCjkFW/asLC5t1luk5HHFJBZ8NIAQ4WAnXQ0c3Q69rDPGbajYscqakHAXxOs 0MgQ== Received: by 10.14.214.197 with SMTP id c45mr12112561eep.7.1354579711843; Mon, 03 Dec 2012 16:08:31 -0800 (PST) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id u8si3546629een.1.2012.12.03.16.08.31 (version=TLSv1/SSLv3 cipher=AES128-SHA); Mon, 03 Dec 2012 16:08:31 -0800 (PST) Received: from tictac.mtv.corp.google.com (tictac.mtv.corp.google.com [172.22.73.80]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id 78BF220004E; Mon, 3 Dec 2012 16:08:31 -0800 (PST) Received: by tictac.mtv.corp.google.com (Postfix, from userid 121310) id BDD1381626; Mon, 3 Dec 2012 16:08:30 -0800 (PST) From: Doug Anderson To: patchwork@lists.ozlabs.org Subject: [PATCH v2 1/3] pwclient: Add command for printing patch info Date: Mon, 3 Dec 2012 16:08:17 -0800 Message-Id: <1354579699-26427-1-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1354564470-12571-1-git-send-email-dianders@chromium.org> References: <1354564470-12571-1-git-send-email-dianders@chromium.org> X-Gm-Message-State: ALoCoQm60K2sxDwGmRN476belSSYdJQsRkpzRa50TftFqCSDBKWa8ow1BGjyul+YYCk4v+wv/ErGV72rF9kCkzDLR6O1weSquEgv5tt3tG+SEoweiTGjqDiw62bIDqafGmQ4EF59tHkTBhHGSFFQMXPK3ievZX7ho12K4kMRsoZ49bS6O8GXDUjRZy0eUtWyCi2KchR6Hf0kdv7FDAIr+CHHt5GLvwY29w== Cc: Jeremy Kerr X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" 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 --- Changes in v2: None apps/patchwork/bin/pwclient | 16 ++++++++++++++-- 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 : Apply a patch (in the current dir, using -p1) git-am : Apply a patch to current git branch using "git am" get : Download a patch and save it locally + info : 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: