From patchwork Thu Jul 10 09:23:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 368859 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id BBC3E1400F5 for ; Fri, 11 Jul 2014 09:29:38 +1000 (EST) Received: from ozlabs.org (ozlabs.org [103.22.144.67]) by lists.ozlabs.org (Postfix) with ESMTP id 929D01A01C2 for ; Fri, 11 Jul 2014 09:29:38 +1000 (EST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 5D13E1A000E for ; Thu, 10 Jul 2014 19:24:05 +1000 (EST) Received: by ozlabs.org (Postfix, from userid 1034) id 43FD414008D; Thu, 10 Jul 2014 19:24:05 +1000 (EST) From: Michael Ellerman To: Jeremy Kerr Subject: [PATCH] pwclient: Don't display header for people who have no patches Date: Thu, 10 Jul 2014 19:23:59 +1000 Message-Id: <1404984239-10417-1-git-send-email-mpe@ellerman.id.au> X-Mailer: git-send-email 1.9.1 X-Mailman-Approved-At: Fri, 11 Jul 2014 09:29:31 +1000 Cc: patchwork@lists.ozlabs.org X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.16 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" When searching for patches by a person, currently pwclient prints the header even for people who have no patches. This makes the output noiser than it needs to be, eg: $ pwclient list -w foo Patches submitted by Ley Foon Tan : ID State Name -- ----- ---- Patches submitted by : ID State Name -- ----- ---- Patches submitted by James Y Knight : ID State Name -- ----- ---- Patches submitted by Steinar H. Gunderson : ID State Name -- ----- ---- Patches submitted by Lars-Peter Clausen : ID State Name -- ----- ---- Patches submitted by ainiaa2k9VG ainiaa5f8VG : ID State Name -- ----- ---- This commit changes the logic to only display the header info if there are patches to display. It also tracks if there were any patches found at all, if not it prints: $ pwclient list -w foo Note: No patches found for anyone matching *foo* Signed-off-by: Michael Ellerman Reviewed-by: "Yann E. MORIN" Tested-by: "Yann E. MORIN" --- apps/patchwork/bin/pwclient | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/patchwork/bin/pwclient b/apps/patchwork/bin/pwclient index dfbea3086275..5aa232378b74 100755 --- a/apps/patchwork/bin/pwclient +++ b/apps/patchwork/bin/pwclient @@ -180,15 +180,24 @@ def action_list(rpc, filter, submitter_str, delegate_str): sys.stderr.write("Note: Nobody found matching *%s*\n" % \ submitter_str) else: + found = False for id in ids: + f = filter + f.add("submitter_id", id) + patches = rpc.patch_list(f.d) + if len(patches) == 0: + continue + + found = True person = rpc.person_get(id) print "Patches submitted by %s <%s>:" % \ (unicode(person['name']).encode("utf-8"), \ unicode(person['email']).encode("utf-8")) - f = filter - f.add("submitter_id", id) - patches = rpc.patch_list(f.d) list_patches(patches) + + if not found: + sys.stderr.write("Note: No patches found for anyone matching *%s*\n" % \ + submitter_str) return if delegate_str != "":