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
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
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
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
50 Date: Wed, 17 Oct 2012 22:07:08 +0300
\r
51 Message-ID: <87y5j42a03.fsf@nikula.org>
\r
53 Content-Type: text/plain; charset=utf-8
\r
54 Content-Transfer-Encoding: quoted-printable
\r
56 ALoCoQk/S1mva9JJzTPMnXMl80YEusvvsRaWjYjVRwunr0pzgTfRe23cAuGX62Z86ODyGK3Udu4B
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\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
72 Nag nag nag: Commit message. ;)
\r
74 The custom is to have a man page for each notmuch cli command.
\r
76 Small nitpicks below.
\r
83 On Wed, 17 Oct 2012, Ben Gamari <bgamari.foss@gmail.com> wrote:
\r
85 > Makefile.local | 1 +
\r
86 > notmuch-client.h | 3 +++
\r
87 > notmuch-compact.c | 43 +++++++++++++++++++++++++++++++++++++++++++
\r
89 > 4 files changed, 50 insertions(+)
\r
90 > create mode 100644 notmuch-compact.c
\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
100 > + notmuch-compact.c \
\r
101 > notmuch-config.c \
\r
102 > notmuch-count.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
112 > +notmuch_compact_command (void *ctx, int argc, char *argv[]);
\r
115 > notmuch_config_command (void *ctx, int argc, char *argv[]);
\r
118 > diff --git a/notmuch-compact.c b/notmuch-compact.c
\r
119 > new file mode 100644
\r
120 > index 0000000..6deb2ec
\r
122 > +++ b/notmuch-compact.c
\r
124 > +/* notmuch - Not much of an email program, (just index and search)
\r
126 > + * Copyright =C2=A9 2009 Carl Worth
\r
128 It's your code, this year.
\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
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
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
144 > + * Author: Carl Worth <cworth@cworth.org>
\r
150 > +#include "notmuch-client.h"
\r
153 > +notmuch_compact_command (void *ctx, unused (int argc), unused (char *arg=
\r
156 > + notmuch_config_t *config;
\r
157 > + notmuch_database_t *notmuch;
\r
159 > + config =3D notmuch_config_open (ctx, NULL, NULL);
\r
160 > + if (config =3D=3D NULL)
\r
163 > + if (notmuch_database_open (notmuch_config_get_database_path (config),
\r
164 > + NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much))
\r
167 > + printf ("Compacting database... ");
\r
168 > + notmuch_database_close_compact (notmuch);
\r
169 > + printf ("Done.\n");
\r
171 Or maybe not. Please add and check the return status of the compact
\r
174 > + notmuch_database_destroy (notmuch);
\r
178 > diff --git a/notmuch.c b/notmuch.c
\r
179 > index 477a09c..7b6c5ae 100644
\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
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
195 > _______________________________________________
\r
196 > notmuch mailing list
\r
197 > notmuch@notmuchmail.org
\r
198 > http://notmuchmail.org/mailman/listinfo/notmuch
\r