Re: Applying patches directly from emails?
[notmuch-archives.git] / 99 / 74ee881786e9bc54e01805d0721242d09acef6
1 Return-Path: <jani@nikula.org>\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 334D2431FBD\r
6         for <notmuch@notmuchmail.org>; Wed, 17 Oct 2012 12:07:17 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 YDtLK6afJV28 for <notmuch@notmuchmail.org>;\r
16         Wed, 17 Oct 2012 12:07:16 -0700 (PDT)\r
17 Received: from mail-la0-f53.google.com (mail-la0-f53.google.com\r
18         [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 46EAE431FB6\r
21         for <notmuch@notmuchmail.org>; Wed, 17 Oct 2012 12:07:16 -0700 (PDT)\r
22 Received: by mail-la0-f53.google.com with SMTP id l5so5760410lah.26\r
23         for <notmuch@notmuchmail.org>; Wed, 17 Oct 2012 12:07:13 -0700 (PDT)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25         d=google.com; s=20120113;\r
26         h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
27         :mime-version:content-type:content-transfer-encoding\r
28         :x-gm-message-state;\r
29         bh=MYC1Rq8EAfmt26A6FMxbvJb7NBpI2me670He6a5LN/Y=;\r
30         b=G+TnfDHvPOf0VltsOX5AM6a+cerOzfzp4pFrRAa0xpB1MPe/9+SLEXqz2q3IYo3R0u\r
31         fvzWY6Jqx9+HHCJGSjFueP4w8LIPX2WU5Xb/gqQlKfgHer1YIYaXK6c8FewzPgZd7dD7\r
32         xsIzTR0glvd1KlQSLbY54s+uRwGK0GeWRBu4MwFJWD/RhMD4SKtsG9vYiRDfobxtfN9I\r
33         tpK9TeEIbdOysW/M9FPo/BLSWS8pdCTiceW39ZRsKGR7jrHvxzwY6545jvwgFWWGeKvC\r
34         FsRzy0G9FcU+pKwCyt5gcEu7zhionCVhcGZ9PRiaR0fDMdqi71s1U1fwtBsctNOND4nZ\r
35         k18Q==\r
36 Received: by 10.112.101.133 with SMTP id fg5mr7158294lbb.3.1350500833112;\r
37         Wed, 17 Oct 2012 12:07:13 -0700 (PDT)\r
38 Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi.\r
39         [80.223.81.27])\r
40         by mx.google.com with ESMTPS id fe5sm4419544lbb.6.2012.10.17.12.07.10\r
41         (version=SSLv3 cipher=OTHER); Wed, 17 Oct 2012 12:07:11 -0700 (PDT)\r
42 From: Jani Nikula <jani@nikula.org>\r
43 To: Ben Gamari <bgamari.foss@gmail.com>, notmuch@notmuchmail.org\r
44 Subject: Re: [PATCH 3/3] Add notmuch compact command\r
45 In-Reply-To: <1350487737-32058-4-git-send-email-bgamari.foss@gmail.com>\r
46 References: <1350487737-32058-1-git-send-email-bgamari.foss@gmail.com>\r
47         <1350487737-32058-4-git-send-email-bgamari.foss@gmail.com>\r
48 User-Agent: Notmuch/0.14+46~g272a1f1 (http://notmuchmail.org) Emacs/23.3.1\r
49         (i686-pc-linux-gnu)\r
50 Date: Wed, 17 Oct 2012 22:07:08 +0300\r
51 Message-ID: <87y5j42a03.fsf@nikula.org>\r
52 MIME-Version: 1.0\r
53 Content-Type: text/plain; charset=utf-8\r
54 Content-Transfer-Encoding: quoted-printable\r
55 X-Gm-Message-State:\r
56  ALoCoQk/S1mva9JJzTPMnXMl80YEusvvsRaWjYjVRwunr0pzgTfRe23cAuGX62Z86ODyGK3Udu4B\r
57 X-BeenThere: notmuch@notmuchmail.org\r
58 X-Mailman-Version: 2.1.13\r
59 Precedence: list\r
60 List-Id: "Use and development of the notmuch mail system."\r
61         <notmuch.notmuchmail.org>\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
65 List-Post: <mailto:notmuch@notmuchmail.org>\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
69 X-List-Received-Date: Wed, 17 Oct 2012 19:07:17 -0000\r
70 \r
71 \r
72 Nag nag nag: Commit message. ;)\r
73 \r
74 The custom is to have a man page for each notmuch cli command.\r
75 \r
76 Small nitpicks below.\r
77 \r
78 \r
79 BR,\r
80 Jani.\r
81 \r
82 \r
83 On Wed, 17 Oct 2012, Ben Gamari <bgamari.foss@gmail.com> wrote:\r
84 > ---\r
85 >  Makefile.local    |    1 +\r
86 >  notmuch-client.h  |    3 +++\r
87 >  notmuch-compact.c |   43 +++++++++++++++++++++++++++++++++++++++++++\r
88 >  notmuch.c         |    3 +++\r
89 >  4 files changed, 50 insertions(+)\r
90 >  create mode 100644 notmuch-compact.c\r
91 >\r
92 > diff --git a/Makefile.local b/Makefile.local\r
93 > index 7f2d4f1..e050ba6 100644\r
94 > --- a/Makefile.local\r
95 > +++ b/Makefile.local\r
96 > @@ -258,6 +258,7 @@ notmuch_client_srcs =3D           \\r
97 >       gmime-filter-headers.c  \\r
98 >       hooks.c                 \\r
99 >       notmuch.c               \\r
100 > +     notmuch-compact.c       \\r
101 >       notmuch-config.c        \\r
102 >       notmuch-count.c         \\r
103 >       notmuch-dump.c          \\r
104 > diff --git a/notmuch-client.h b/notmuch-client.h\r
105 > index ae9344b..a6c624b 100644\r
106 > --- a/notmuch-client.h\r
107 > +++ b/notmuch-client.h\r
108 > @@ -157,6 +157,9 @@ int\r
109 >  notmuch_cat_command (void *ctx, int argc, char *argv[]);\r
110 >=20=20\r
111 >  int\r
112 > +notmuch_compact_command (void *ctx, int argc, char *argv[]);\r
113 > +\r
114 > +int\r
115 >  notmuch_config_command (void *ctx, int argc, char *argv[]);\r
116 >=20=20\r
117 >  const char *\r
118 > diff --git a/notmuch-compact.c b/notmuch-compact.c\r
119 > new file mode 100644\r
120 > index 0000000..6deb2ec\r
121 > --- /dev/null\r
122 > +++ b/notmuch-compact.c\r
123 > @@ -0,0 +1,43 @@\r
124 > +/* notmuch - Not much of an email program, (just index and search)\r
125 > + *\r
126 > + * Copyright =C2=A9 2009 Carl Worth\r
127 \r
128 It's your code, this year.\r
129 \r
130 > + *\r
131 > + * This program is free software: you can redistribute it and/or modify\r
132 > + * it under the terms of the GNU General Public License as published by\r
133 > + * the Free Software Foundation, either version 3 of the License, or\r
134 > + * (at your option) any later version.\r
135 > + *\r
136 > + * This program is distributed in the hope that it will be useful,\r
137 > + * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
138 > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
139 > + * GNU General Public License for more details.\r
140 > + *\r
141 > + * You should have received a copy of the GNU General Public License\r
142 > + * along with this program.  If not, see http://www.gnu.org/licenses/ .\r
143 > + *\r
144 > + * Author: Carl Worth <cworth@cworth.org>\r
145 \r
146 It's your code.\r
147 \r
148 > + */\r
149 > +\r
150 > +#include "notmuch-client.h"\r
151 > +\r
152 > +int\r
153 > +notmuch_compact_command (void *ctx, unused (int argc), unused (char *arg=\r
154 v[]))\r
155 > +{\r
156 > +    notmuch_config_t *config;\r
157 > +    notmuch_database_t *notmuch;\r
158 > +\r
159 > +    config =3D notmuch_config_open (ctx, NULL, NULL);\r
160 > +    if (config =3D=3D NULL)\r
161 > +     return 1;\r
162 > +\r
163 > +    if (notmuch_database_open (notmuch_config_get_database_path (config),\r
164 > +                            NOTMUCH_DATABASE_MODE_READ_WRITE, &notmuch))\r
165 > +     return 1;\r
166 > +\r
167 > +    printf ("Compacting database... ");\r
168 > +    notmuch_database_close_compact (notmuch);\r
169 > +    printf ("Done.\n");\r
170 \r
171 Or maybe not. Please add and check the return status of the compact\r
172 call.\r
173 \r
174 > +    notmuch_database_destroy (notmuch);\r
175 > +\r
176 > +    return 0;\r
177 > +}\r
178 > diff --git a/notmuch.c b/notmuch.c\r
179 > index 477a09c..7b6c5ae 100644\r
180 > --- a/notmuch.c\r
181 > +++ b/notmuch.c\r
182 > @@ -74,6 +74,9 @@ static command_t commands[] =3D {\r
183 >      { "restore", notmuch_restore_command,\r
184 >        "[--accumulate] [<filename>]",\r
185 >        "Restore the tags from the given dump file (see 'dump')." },\r
186 > +    { "compact", notmuch_compact_command,\r
187 > +      NULL,\r
188 > +      "Compacts the database." },\r
189 >      { "config", notmuch_config_command,\r
190 >        "[get|set] <section>.<item> [value ...]",\r
191 >        "Get or set settings in the notmuch configuration file." },\r
192 > --=20\r
193 > 1.7.10.4\r
194 >\r
195 > _______________________________________________\r
196 > notmuch mailing list\r
197 > notmuch@notmuchmail.org\r
198 > http://notmuchmail.org/mailman/listinfo/notmuch\r