From 486e957fc0821bdc93e1eb9168543fb343cfb828 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Thu, 17 Jul 2014 07:04:19 +2100 Subject: [PATCH] Re: [PATCH 3/4] nmbug: Catch stderr in is_unmerged --- ff/55cdbdd5a3aefdbb8241fcaba3d17a4bb6ede5 | 97 +++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 ff/55cdbdd5a3aefdbb8241fcaba3d17a4bb6ede5 diff --git a/ff/55cdbdd5a3aefdbb8241fcaba3d17a4bb6ede5 b/ff/55cdbdd5a3aefdbb8241fcaba3d17a4bb6ede5 new file mode 100644 index 000000000..511ed44ff --- /dev/null +++ b/ff/55cdbdd5a3aefdbb8241fcaba3d17a4bb6ede5 @@ -0,0 +1,97 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 1EA1B431FC0 + for ; Wed, 16 Jul 2014 03:04:31 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id uQ-Xmsx8J0LT for ; + Wed, 16 Jul 2014 03:04:23 -0700 (PDT) +Received: from yantan.tethera.net (yantan.tethera.net [199.188.72.155]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 78AFF431FBD + for ; Wed, 16 Jul 2014 03:04:23 -0700 (PDT) +Received: from remotemail by yantan.tethera.net with local (Exim 4.80) + (envelope-from ) + id 1X7M4U-0005SP-Th; Wed, 16 Jul 2014 07:04:22 -0300 +Received: (nullmailer pid 6752 invoked by uid 1000); Wed, 16 Jul 2014 + 10:04:19 -0000 +From: David Bremner +To: "W. Trevor King" +Subject: Re: [PATCH 3/4] nmbug: Catch stderr in is_unmerged +In-Reply-To: <20140716001730.GI30232@odin> +References: + + <871ttm89nd.fsf@maritornes.cs.unb.ca> <20140716001730.GI30232@odin> +User-Agent: Notmuch/0.18.1+45~gf47eeac (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-pc-linux-gnu) +Date: Wed, 16 Jul 2014 07:04:19 -0300 +Message-ID: <87y4vt8vrw.fsf@maritornes.cs.unb.ca> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Transfer-Encoding: quoted-printable +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 16 Jul 2014 10:04:31 -0000 + +"W. Trevor King" writes: + +> +> There should be standard Perl syntax for capturing both streams ;). I +> can add a separate parameter instead, but Perl doesn't seem to have +> keyword-arguments. At least, nmbug relies on assumptions about +> argument values: +> +> sub git_pipe { +> my $envref =3D (ref $_[0] eq 'HASH') ? shift : {}; +> my $ioref =3D (ref $_[0] eq 'ARRAY') ? shift : undef; +> my $dir =3D ($_[0] eq '-|' or $_[0] eq '|-') ? shift : undef; +> =E2=80=A6 +> } +> + +Perl supports keyword arguments fine, by passing a single hash=20 +to the subroutine. This particular sub doesn't do things that way, but +it's only called in three places, so it would be simple enough to change +the calling convention to to + +git_pipe (env =3D> {}, lines=3D>[],=20 + command =3D> [ qw/diff-index --cached/, + "--diff-filter=3D$filter", qw/--name-only HEAD/ ], + redirect =3D> [ whatever you want here ]=20=20=20=20=20=20=20=20= +=20=20=20=20=20=20=20=20=20 + ) + + +> I'd be happy to rewrite nmbug in Python too, which has (to my eyes) +> much saner kwargs and subprocess handling. + +Although I think that's an extreme answer to this particular issue ;), I +do think it's worth discussing. In particular I think it would be +reasonable to consider an updated nmbug that used the python bindings to +notmuch, for possibly more speed. Of the people that currently work on +nmbug (I count myself, yourself, and Tomi), I think we're all ok with +python. I know at least Jani mentioned he'd be more interested in +contributing to a python version. + +d + -- 2.26.2