1 Return-Path: <bremner@tethera.net>
\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 374B4431FBC
\r
6 for <notmuch@notmuchmail.org>; Fri, 14 Dec 2012 05:34:39 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 VVX6iSdW25BS for <notmuch@notmuchmail.org>;
\r
16 Fri, 14 Dec 2012 05:34:35 -0800 (PST)
\r
17 Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])
\r
18 (using TLSv1 with cipher AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id B506D431FB6
\r
21 for <notmuch@notmuchmail.org>; Fri, 14 Dec 2012 05:34:35 -0800 (PST)
\r
22 Received: from fctnnbsc30w-142167090129.dhcp-dynamic.fibreop.nb.bellaliant.net
\r
23 ([142.167.90.129] helo=zancas.localnet)
\r
24 by tesseract.cs.unb.ca with esmtpsa
\r
25 (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72)
\r
26 (envelope-from <bremner@tethera.net>) id 1TjVPM-0004ya-F6
\r
27 for notmuch@notmuchmail.org; Fri, 14 Dec 2012 09:34:35 -0400
\r
28 Received: from bremner by zancas.localnet with local (Exim 4.80)
\r
29 (envelope-from <bremner@tethera.net>) id 1TjVPG-00021h-Uk
\r
30 for notmuch@notmuchmail.org; Fri, 14 Dec 2012 09:34:26 -0400
\r
31 From: david@tethera.net
\r
32 To: notmuch@notmuchmail.org
\r
33 Subject: v7 batch tagging series
\r
34 Date: Fri, 14 Dec 2012 09:34:08 -0400
\r
35 Message-Id: <1355492062-7546-1-git-send-email-david@tethera.net>
\r
36 X-Mailer: git-send-email 1.7.10.4
\r
38 X-BeenThere: notmuch@notmuchmail.org
\r
39 X-Mailman-Version: 2.1.13
\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: Fri, 14 Dec 2012 13:34:39 -0000
\r
53 This obsoletes id:1355096008-4544-1-git-send-email-david@tethera.net
\r
55 There are some fixups according to previous reviews, detailed in a
\r
58 I have just read id:871uettxln.fsf@qmul.ac.uk; this series doesn't
\r
61 There are some new trivial cosmetic patches; except for conflicts
\r
62 these don't really need to be part of this series.
\r
64 [Patch v7 01/14] parse_tag_line: use enum for return value.
\r
65 [Patch v7 13/14] notmuch-tag.1: tidy synopsis formatting
\r
67 This version includes a bunch of test patches (patches 8-12).
\r
69 The other reason for the increase in the number of patches is that I
\r
70 discovered a bug in the previous version (when I implement patch
\r
71 11/14), and I had to add some internal quoting for queries:
\r
73 [Patch v7 04/14] notmuch-tag: factor out double quoting routine
\r
74 [Patch v7 05/14] quote_and_decode_query: new function to quote
\r
75 [Patch v7 06/14] notmuch-restore: move query handling for batch
\r
77 commit 6f4a8ac5fb90b301bc905c4ea90cdf33456eb06e
\r
78 Author: David Bremner <bremner@debian.org>
\r
79 Date: Tue Dec 11 22:12:50 2012 -0400
\r
81 formatting fixup for illegal_tag
\r
83 diff --git a/tag-util.c b/tag-util.c
\r
84 index 2214f34..091e1ec 100644
\r
87 @@ -39,17 +39,18 @@ line_error (tag_parse_status_t status,
\r
91 -illegal_tag (const char *tag, notmuch_bool_t remove) {
\r
92 +illegal_tag (const char *tag, notmuch_bool_t remove)
\r
95 - if (*tag == '\0' && !remove)
\r
96 + if (*tag == '\0' && ! remove)
\r
97 return "adding empty tag";
\r
99 /* This disallows adding the non-removable tag "-" and
\r
100 * enables notmuch tag to take long options more easily.
\r
103 - if (*tag == '-' && !remove)
\r
104 - return "adding tag starting with -";
\r
105 + if (*tag == '-' && ! remove)
\r
106 + return "adding tag starting with -";
\r
111 commit 60ca31c81adfb3b9c2ca6e2d2eaee6fcc483ea97
\r
112 Author: David Bremner <bremner@debian.org>
\r
113 Date: Tue Dec 11 22:17:48 2012 -0400
\r
115 uncrustify fixup for parse_tag_command_line
\r
117 diff --git a/tag-util.c b/tag-util.c
\r
118 index 091e1ec..30d856d 100644
\r
121 @@ -45,8 +45,9 @@ illegal_tag (const char *tag, notmuch_bool_t remove)
\r
122 if (*tag == '\0' && ! remove)
\r
123 return "adding empty tag";
\r
125 - /* This disallows adding the non-removable tag "-" and
\r
126 - * enables notmuch tag to take long options more easily.
\r
127 + /* This disallows adding tags starting with "-", in particular the
\r
128 + * non-removable tag "-" and enables notmuch tag to take long
\r
129 + * options more easily.
\r
132 if (*tag == '-' && ! remove)
\r
133 @@ -165,12 +166,13 @@ parse_tag_line (void *ctx, char *line,
\r
136 parse_tag_command_line (void *ctx, int argc, char **argv,
\r
137 - unused(tag_op_flag_t flags),
\r
138 - char **query_str, tag_op_list_t *tag_ops){
\r
139 + unused (tag_op_flag_t flags),
\r
140 + char **query_str, tag_op_list_t *tag_ops)
\r
145 - tag_op_list_reset(tag_ops);
\r
146 + tag_op_list_reset (tag_ops);
\r
148 for (i = 0; i < argc; i++) {
\r
149 if (strcmp (argv[i], "--") == 0) {
\r
150 @@ -182,7 +184,7 @@ parse_tag_command_line (void *ctx, int argc, char **argv,
\r
151 notmuch_bool_t is_remove = argv[i][0] == '-';
\r
154 - msg = illegal_tag(argv[i]+1, is_remove);
\r
155 + msg = illegal_tag (argv[i] + 1, is_remove);
\r
157 fprintf (stderr, "Error: %s", msg);
\r
160 commit f3ae405abda331558affedf52391a067acc7b7df
\r
161 Author: David Bremner <bremner@debian.org>
\r
162 Date: Tue Dec 11 22:21:46 2012 -0400
\r
164 remove unused flags
\r
166 diff --git a/notmuch-tag.c b/notmuch-tag.c
\r
167 index 2665037..a5e8715 100644
\r
168 --- a/notmuch-tag.c
\r
169 +++ b/notmuch-tag.c
\r
170 @@ -242,7 +242,7 @@ notmuch_tag_command (void *ctx, int argc, char *argv[])
\r
173 if (parse_tag_command_line (ctx, argc - opt_index, argv + opt_index,
\r
174 - 0, &query_string, tag_ops))
\r
175 + &query_string, tag_ops))
\r
179 diff --git a/tag-util.c b/tag-util.c
\r
180 index 30d856d..e7ee182 100644
\r
183 @@ -166,7 +166,6 @@ parse_tag_line (void *ctx, char *line,
\r
186 parse_tag_command_line (void *ctx, int argc, char **argv,
\r
187 - unused (tag_op_flag_t flags),
\r
188 char **query_str, tag_op_list_t *tag_ops)
\r
191 diff --git a/tag-util.h b/tag-util.h
\r
192 index 4956725..2889736 100644
\r
195 @@ -85,7 +85,6 @@ parse_tag_line (void *ctx, char *line,
\r
198 parse_tag_command_line (void *ctx, int argc, char **argv,
\r
199 - tag_op_flag_t flags,
\r
200 char **query_str, tag_op_list_t *ops);
\r
204 commit c1aa36573bb991a1d06dd2e234a2377e2a32bd66
\r
205 Author: David Bremner <bremner@debian.org>
\r
206 Date: Tue Dec 11 22:25:40 2012 -0400
\r
208 use enum values in parse_tag_command_line
\r
210 diff --git a/tag-util.c b/tag-util.c
\r
211 index e7ee182..102adcc 100644
\r
214 @@ -164,7 +164,7 @@ parse_tag_line (void *ctx, char *line,
\r
219 +tag_parse_status_t
\r
220 parse_tag_command_line (void *ctx, int argc, char **argv,
\r
221 char **query_str, tag_op_list_t *tag_ops)
\r
223 @@ -186,7 +186,7 @@ parse_tag_command_line (void *ctx, int argc, char **argv,
\r
224 msg = illegal_tag (argv[i] + 1, is_remove);
\r
226 fprintf (stderr, "Error: %s", msg);
\r
228 + return TAG_PARSE_INVALID;
\r
231 tag_op_list_append (ctx, tag_ops,
\r
232 @@ -198,17 +198,17 @@ parse_tag_command_line (void *ctx, int argc, char **argv,
\r
234 if (tag_op_list_size (tag_ops) == 0) {
\r
235 fprintf (stderr, "Error: 'notmuch tag' requires at least one tag to add or remove.\n");
\r
237 + return TAG_PARSE_INVALID;
\r
240 *query_str = query_string_from_args (ctx, argc - i, &argv[i]);
\r
242 if (**query_str == '\0') {
\r
243 fprintf (stderr, "Error: notmuch tag requires at least one search term.\n");
\r
245 + return TAG_PARSE_INVALID;
\r
249 + return TAG_PARSE_SUCCESS;
\r
254 commit 562200240098238211d2ea0299b2ae03f4dbe919
\r
255 Author: David Bremner <bremner@debian.org>
\r
256 Date: Tue Dec 11 22:32:31 2012 -0400
\r
258 remaining changes for id:87k3spa9nk.fsf@nikula.org
\r
260 diff --git a/tag-util.c b/tag-util.c
\r
261 index 102adcc..43d19e1 100644
\r
264 @@ -179,21 +179,19 @@ parse_tag_command_line (void *ctx, int argc, char **argv,
\r
268 - if (argv[i][0] == '+' || argv[i][0] == '-') {
\r
269 - notmuch_bool_t is_remove = argv[i][0] == '-';
\r
271 + if (argv[i][0] != '+' && argv[i][0] != '-')
\r
274 - msg = illegal_tag (argv[i] + 1, is_remove);
\r
276 - fprintf (stderr, "Error: %s", msg);
\r
277 - return TAG_PARSE_INVALID;
\r
279 + notmuch_bool_t is_remove = argv[i][0] == '-';
\r
282 - tag_op_list_append (ctx, tag_ops,
\r
283 - argv[i] + 1, (argv[i][0] == '-'));
\r
286 + msg = illegal_tag (argv[i] + 1, is_remove);
\r
288 + fprintf (stderr, "Error: %s", msg);
\r
289 + return TAG_PARSE_INVALID;
\r
292 + tag_op_list_append (ctx, tag_ops, argv[i] + 1, is_remove);
\r
295 if (tag_op_list_size (tag_ops) == 0) {
\r
296 @@ -203,7 +201,7 @@ parse_tag_command_line (void *ctx, int argc, char **argv,
\r
298 *query_str = query_string_from_args (ctx, argc - i, &argv[i]);
\r
300 - if (**query_str == '\0') {
\r
301 + if (*query_str == NULL || **query_str == '\0') {
\r
302 fprintf (stderr, "Error: notmuch tag requires at least one search term.\n");
\r
303 return TAG_PARSE_INVALID;
\r
306 commit c991402c6571003b79e855965fe1e3b6ae2dde35
\r
307 Author: David Bremner <bremner@debian.org>
\r
308 Date: Tue Dec 11 22:35:52 2012 -0400
\r
310 "fix" comment about tag_op_list; assume tag-utils.h docs are sufficient.
\r
312 diff --git a/notmuch-tag.c b/notmuch-tag.c
\r
313 index a5e8715..508f04d 100644
\r
314 --- a/notmuch-tag.c
\r
315 +++ b/notmuch-tag.c
\r
316 @@ -108,9 +108,8 @@ _optimize_tag_query (void *ctx, const char *orig_query_string,
\r
317 return query_string;
\r
320 -/* Tag messages matching 'query_string' according to 'tag_ops', which
\r
321 - * must be an array of tagging operations terminated with an empty
\r
323 +/* Tag messages matching 'query_string' according to 'tag_ops'
\r
326 tag_query (void *ctx, notmuch_database_t *notmuch, const char *query_string,
\r
327 tag_op_list_t *tag_ops, tag_op_flag_t flags)
\r
329 commit 80628aceff38cad5f48e0ec7f381bbf8cec85cb2
\r
330 Author: David Bremner <bremner@debian.org>
\r
331 Date: Tue Dec 11 22:44:17 2012 -0400
\r
333 slightly longwindedly make sure we return non-zero if tag_query fails
\r
335 diff --git a/notmuch-tag.c b/notmuch-tag.c
\r
336 index 508f04d..8f700b0 100644
\r
337 --- a/notmuch-tag.c
\r
338 +++ b/notmuch-tag.c
\r
339 @@ -174,8 +174,11 @@ tag_file (void *ctx, notmuch_database_t *notmuch, tag_op_flag_t flags,
\r
343 - if (ret < 0 || tag_query (ctx, notmuch, query_string,
\r
348 + ret = tag_query (ctx, notmuch, query_string, tag_ops, flags);
\r
354 commit d1be30ed7eab8a1e9e0a492c0f024880f63236bb
\r
355 Author: David Bremner <bremner@debian.org>
\r
356 Date: Tue Dec 11 22:44:30 2012 -0400
\r
358 close an input file if we opened it
\r
360 diff --git a/notmuch-tag.c b/notmuch-tag.c
\r
361 index 8f700b0..b707c25 100644
\r
362 --- a/notmuch-tag.c
\r
363 +++ b/notmuch-tag.c
\r
364 @@ -264,6 +264,9 @@ notmuch_tag_command (void *ctx, int argc, char *argv[])
\r
366 ret = tag_query (ctx, notmuch, query_string, tag_ops, tag_flags);
\r
368 + if (input != stdin)
\r
371 notmuch_database_destroy (notmuch);
\r
373 return ret || interrupted;
\r
375 commit 702a2b11d43616f9b2ad74fb772ad080c228ab0a
\r
376 Author: David Bremner <bremner@debian.org>
\r
377 Date: Tue Dec 11 23:37:51 2012 -0400
\r
379 fixup for illegal_tag error messages
\r
381 diff --git a/tag-util.c b/tag-util.c
\r
382 index 43d19e1..f89669a 100644
\r
385 @@ -43,7 +43,7 @@ illegal_tag (const char *tag, notmuch_bool_t remove)
\r
388 if (*tag == '\0' && ! remove)
\r
389 - return "adding empty tag";
\r
390 + return "empty tag forbidden";
\r
392 /* This disallows adding tags starting with "-", in particular the
\r
393 * non-removable tag "-" and enables notmuch tag to take long
\r
394 @@ -51,7 +51,7 @@ illegal_tag (const char *tag, notmuch_bool_t remove)
\r
397 if (*tag == '-' && ! remove)
\r
398 - return "adding tag starting with -";
\r
399 + return "tag starting with '-' forbidden";
\r