Re: [PATCH] create .mailmap file (for git shortlog/blame)
[notmuch-archives.git] / a4 / 0fa1949b3d9d632a9f7365d8c2136fb5ac2961
1 Return-Path: <bgamari.foss@gmail.com>\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 4DACC429E32\r
6         for <notmuch@notmuchmail.org>; Fri, 23 Aug 2013 19:55:40 -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.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id BuHsabDZzCiC for <notmuch@notmuchmail.org>;\r
17         Fri, 23 Aug 2013 19:55:35 -0700 (PDT)\r
18 Received: from mail-qe0-f44.google.com (mail-qe0-f44.google.com\r
19         [209.85.128.44]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 55A9F431FD9\r
22         for <notmuch@notmuchmail.org>; Fri, 23 Aug 2013 19:55:31 -0700 (PDT)\r
23 Received: by mail-qe0-f44.google.com with SMTP id 5so757329qeb.17\r
24         for <notmuch@notmuchmail.org>; Fri, 23 Aug 2013 19:55:30 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
26         h=from:to:cc:subject:date:message-id:in-reply-to:references\r
27         :mime-version:content-type:content-transfer-encoding;\r
28         bh=hEsOS6pgxy9QkaJlT5pnQl4Jj+/XHDXiS1y16fxoz9A=;\r
29         b=v68OotxsIdVFgEZGbxJwE5lUZ22Dd6AkclVv7XcAY0iXd9V6lS1N4bQqxIQEf+tT6A\r
30         rdpHvL2HVFmFxXWCcbbB+aywo4VZB//WQbR5tPGRgGx+wDJQUY8Noob9jxReJWuoR4Qt\r
31         4Vb/fFMhvsuBxG2Wnk+ls05ZbXjq7PAojT2uu7mvCkUa9Vk7qpZDMeDwXqvWe3FKBvCY\r
32         5rTTV+DKJJvk2tX+x32Dq84mCqeOazcRkdvIQTvKabiujxeXCW21b1peTc0PKEEAjXX0\r
33         0QSZW7mvhDawhddFORhCYwj+VvHKQg9jMZ6Q++W4aclj3YTNknqZAC2l0l64xji4zU9o\r
34         9iBg==\r
35 X-Received: by 10.224.160.194 with SMTP id o2mr2613108qax.3.1377312930804;\r
36         Fri, 23 Aug 2013 19:55:30 -0700 (PDT)\r
37 Received: from localhost.localdomain\r
38         (pool-108-8-228-201.spfdma.east.verizon.net. [108.8.228.201])\r
39         by mx.google.com with ESMTPSA id a2sm4350757qek.7.1969.12.31.16.00.00\r
40         (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);\r
41         Fri, 23 Aug 2013 19:55:30 -0700 (PDT)\r
42 From: Ben Gamari <bgamari.foss@gmail.com>\r
43 To: notmuch@notmuchmail.org\r
44 Subject: [PATCH 2/3] notmuch-compact: Initial commit\r
45 Date: Fri, 23 Aug 2013 22:55:22 -0400\r
46 Message-Id: <1377312923-32274-3-git-send-email-bgamari.foss@gmail.com>\r
47 X-Mailer: git-send-email 1.8.1.2\r
48 In-Reply-To: <1377312923-32274-1-git-send-email-bgamari.foss@gmail.com>\r
49 References: <1377312923-32274-1-git-send-email-bgamari.foss@gmail.com>\r
50 MIME-Version: 1.0\r
51 Content-Type: text/plain; charset=UTF-8\r
52 Content-Transfer-Encoding: 8bit\r
53 X-BeenThere: notmuch@notmuchmail.org\r
54 X-Mailman-Version: 2.1.13\r
55 Precedence: list\r
56 List-Id: "Use and development of the notmuch mail system."\r
57         <notmuch.notmuchmail.org>\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
61 List-Post: <mailto:notmuch@notmuchmail.org>\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
65 X-List-Received-Date: Sat, 24 Aug 2013 02:55:40 -0000\r
66 \r
67 Introduce the user command exposing the new compaction facility.\r
68 \r
69 Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>\r
70 ---\r
71  Makefile.local    |  1 +\r
72  notmuch-client.h  |  6 ++++++\r
73  notmuch-compact.c | 43 +++++++++++++++++++++++++++++++++++++++++++\r
74  notmuch.c         |  2 ++\r
75  4 files changed, 52 insertions(+)\r
76  create mode 100644 notmuch-compact.c\r
77 \r
78 diff --git a/Makefile.local b/Makefile.local\r
79 index b7cd266..0464a50 100644\r
80 --- a/Makefile.local\r
81 +++ b/Makefile.local\r
82 @@ -257,6 +257,7 @@ notmuch_client_srcs =               \\r
83         gmime-filter-reply.c    \\r
84         hooks.c                 \\r
85         notmuch.c               \\r
86 +       notmuch-compact.c       \\r
87         notmuch-config.c        \\r
88         notmuch-count.c         \\r
89         notmuch-dump.c          \\r
90 diff --git a/notmuch-client.h b/notmuch-client.h\r
91 index da332f3..5b8a076 100644\r
92 --- a/notmuch-client.h\r
93 +++ b/notmuch-client.h\r
94 @@ -203,6 +203,12 @@ notmuch_tag_command (notmuch_config_t *config, int argc, char *argv[]);\r
95  int\r
96  notmuch_config_command (notmuch_config_t *config, int argc, char *argv[]);\r
97  \r
98 +int\r
99 +notmuch_compact_command (notmuch_config_t *config, int argc, char *argv[]);\r
100 +\r
101 +int\r
102 +notmuch_config_command (notmuch_config_t *config, int argc, char *argv[]);\r
103 +\r
104  const char *\r
105  notmuch_time_relative_date (const void *ctx, time_t then);\r
106  \r
107 diff --git a/notmuch-compact.c b/notmuch-compact.c\r
108 new file mode 100644\r
109 index 0000000..72b5c1e\r
110 --- /dev/null\r
111 +++ b/notmuch-compact.c\r
112 @@ -0,0 +1,43 @@\r
113 +/* notmuch - Not much of an email program, (just index and search)\r
114 + *\r
115 + * Copyright © 2013 Ben Gmaari\r
116 + *\r
117 + * This program is free software: you can redistribute it and/or modify\r
118 + * it under the terms of the GNU General Public License as published by\r
119 + * the Free Software Foundation, either version 3 of the License, or\r
120 + * (at your option) any later version.\r
121 + *\r
122 + * This program is distributed in the hope that it will be useful,\r
123 + * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
124 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
125 + * GNU General Public License for more details.\r
126 + *\r
127 + * You should have received a copy of the GNU General Public License\r
128 + * along with this program.  If not, see http://www.gnu.org/licenses/ .\r
129 + *\r
130 + * Author: Ben Gamari <bgamari.foss@gmail.com>\r
131 + */\r
132 +\r
133 +#include "notmuch-client.h"\r
134 +\r
135 +int\r
136 +notmuch_compact_command (notmuch_config_t *config, unused (int argc), unused (char *argv[]))\r
137 +{\r
138 +    notmuch_database_t *notmuch;\r
139 +    notmuch_status_t ret;\r
140 +\r
141 +    if (notmuch_database_open (notmuch_config_get_database_path (config),\r
142 +                              NOTMUCH_DATABASE_MODE_READ_WRITE, &notmuch))\r
143 +       return 1;\r
144 +\r
145 +    printf ("Compacting database...\n");\r
146 +    ret = notmuch_database_compact_close (notmuch);\r
147 +    if (ret) {\r
148 +       fprintf (stderr, "Compaction failed: %s\n", notmuch_status_to_string(ret));\r
149 +    } else {\r
150 +       printf ("Done.\n");\r
151 +    }\r
152 +    notmuch_database_destroy (notmuch);\r
153 +\r
154 +    return 0;\r
155 +}\r
156 diff --git a/notmuch.c b/notmuch.c\r
157 index 78d29a8..ab0b1cf 100644\r
158 --- a/notmuch.c\r
159 +++ b/notmuch.c\r
160 @@ -60,6 +60,8 @@ static command_t commands[] = {\r
161        "Create a plain-text dump of the tags for each message." },\r
162      { "restore", notmuch_restore_command, FALSE,\r
163        "Restore the tags from the given dump file (see 'dump')." },\r
164 +    { "compact", notmuch_compact_command, FALSE,\r
165 +      "Compact the notmuch database." },\r
166      { "config", notmuch_config_command, FALSE,\r
167        "Get or set settings in the notmuch configuration file." },\r
168      { "help", notmuch_help_command, TRUE, /* create but don't save config */\r
169 -- \r
170 1.8.1.2\r
171 \r