[PATCH v2 08/14] cli/reply: reduce the reply format abstractions
[notmuch-archives.git] / b3 / 806438fa5695c292c832a97080df3a6fbbdea0
1 Return-Path: <tomi.ollila@iki.fi>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id D5884431FC9\r
6         for <notmuch@notmuchmail.org>; Wed, 13 Feb 2013 06:47:40 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id 3ryCz639nk8A for <notmuch@notmuchmail.org>;\r
16         Wed, 13 Feb 2013 06:47:40 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 13641431FC7\r
19         for <notmuch@notmuchmail.org>; Wed, 13 Feb 2013 06:47:40 -0800 (PST)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id AB06B10007D;\r
22         Wed, 13 Feb 2013 16:47:27 +0200 (EET)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: david@tethera.net, notmuch@notmuchmail.org\r
25 Subject: Re: [PATCH] contrib/nmbug: convert to use batch tagging.\r
26 In-Reply-To: <1360374019-20988-1-git-send-email-david@tethera.net>\r
27 References: <1360374019-20988-1-git-send-email-david@tethera.net>\r
28 User-Agent: Notmuch/0.15+20~g7e29ae9 (http://notmuchmail.org) Emacs/24.2.1\r
29         (x86_64-unknown-linux-gnu)\r
30 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
31         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
32         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
33 Date: Wed, 13 Feb 2013 16:47:27 +0200\r
34 Message-ID: <m2boboe0e8.fsf@guru.guru-group.fi>\r
35 MIME-Version: 1.0\r
36 Content-Type: text/plain\r
37 Cc: David Bremner <bremner@debian.org>\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.13\r
40 Precedence: list\r
41 List-Id: "Use and development of the notmuch mail system."\r
42         <notmuch.notmuchmail.org>\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
46 List-Post: <mailto:notmuch@notmuchmail.org>\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
50 X-List-Received-Date: Wed, 13 Feb 2013 14:47:41 -0000\r
51 \r
52 On Sat, Feb 09 2013, david@tethera.net wrote:\r
53 \r
54 > From: David Bremner <bremner@debian.org>\r
55 >\r
56 > In the case of large changes to the database from git, one of main\r
57 > current bottlenecks is the large number of execs of notmuch tag. This\r
58 > avoids that by using use the batch tagging facilities as of notmuch\r
59 > 0.15.\r
60 >\r
61 > We use "spawn" directly rather than inventing a "notmuch_pipe", since\r
62 > it seems the only place we need to pipe to notmuch so far.\r
63 > ---\r
64 \r
65 The code LGTM. Is there any quoting differences between these 2 \r
66 tagging methods ?\r
67 \r
68 > This is only lightly tested; please make sure you have backups of your\r
69 > database.\r
70 \r
71 Do I dare to test -- I'm lazy taking backups (I don't know how to take\r
72 one -- and especially how to restore one ;)\r
73 \r
74 > I'm not 100% sure about the indentation. No doubt Tomi will let me\r
75 > know if it can be improved.\r
76 \r
77 No doubt...\r
78 \r
79 Tomi\r
80 \r
81 >\r
82 >  contrib/nmbug/nmbug |   15 ++++++++++-----\r
83 >  1 file changed, 10 insertions(+), 5 deletions(-)\r
84 >\r
85 > diff --git a/contrib/nmbug/nmbug b/contrib/nmbug/nmbug\r
86 > index f003ef9..c66c526 100755\r
87 > --- a/contrib/nmbug/nmbug\r
88 > +++ b/contrib/nmbug/nmbug\r
89 > @@ -270,17 +270,22 @@ sub do_sync {\r
90 >      $D_action = '-';\r
91 >    }\r
92 >  \r
93 > -  foreach my $pair (@{$status->{added}}) {\r
94 > +  my $notmuch = spawn ({}, '|-', qw/notmuch tag --batch/)\r
95 > +      or die 'notmuch tag --batch';\r
96 >  \r
97 > -    notmuch ('tag', $A_action.$TAGPREFIX.$pair->{tag},\r
98 > -          'id:'.$pair->{id});\r
99 > +  foreach my $pair (@{$status->{added}}) {\r
100 > +    print $notmuch $A_action.$TAGPREFIX.$pair->{tag}, " -- ",\r
101 > +      'id:'.$pair->{id};\r
102 >    }\r
103 >  \r
104 >    foreach my $pair (@{$status->{deleted}}) {\r
105 > -    notmuch ('tag', $D_action.$TAGPREFIX.$pair->{tag},\r
106 > -          'id:'.$pair->{id});\r
107 > +    print $notmuch $D_action.$TAGPREFIX.$pair->{tag},\r
108 > +      'id:'.$pair->{id};\r
109 >    }\r
110 >  \r
111 > +  unless (close $notmuch) {\r
112 > +    die "'notmuch tag --batch' exited with nonzero value\n";\r
113 > +  }\r
114 >  }\r
115 >  \r
116 >  \r
117 > -- \r
118 > 1.7.10.4\r
119 >\r
120 > _______________________________________________\r
121 > notmuch mailing list\r
122 > notmuch@notmuchmail.org\r
123 > http://notmuchmail.org/mailman/listinfo/notmuch\r