Re: V6 batch tagging patches.

Subject: Re: V6 batch tagging patches.

Date: Sun, 09 Dec 2012 20:59:56 -0400

To: notmuch@notmuchmail.org

Cc:

From: David Bremner


david@tethera.net writes:

> This obsoletes the remaining patches in 
>
>      id:1353792017-31459-1-git-send-email-david@tethera.net
>
> This isn't really v6 of these particular patches, but oh well.

I forgot to mention that I will probably add some more tests; several of
the dump/restore batch-tag format tests can be re-used.

Here is a log of changes for the last set of reviews.

commit 120b1aef754cbe969e0421d5557f0308381f73d2
Author: David Bremner <bremner@debian.org>
Date:   Sun Dec 9 15:57:10 2012 -0400

    fixup for id:87txs5qqeb.fsf@nikula.org

diff --git a/notmuch-tag.c b/notmuch-tag.c
index dbd98a0..b8732f6 100644
--- a/notmuch-tag.c
+++ b/notmuch-tag.c
@@ -169,7 +169,7 @@ tag_file (void *ctx, notmuch_database_t *notmuch, tag_op_flag_t flags,
     while ((line_len = getline (&line, &line_size, input)) != -1 &&
 	   ! interrupted) {
 
-	ret =  parse_tag_line (ctx, line, TAG_FLAG_NONE,
+	ret = parse_tag_line (ctx, line, TAG_FLAG_NONE,
 			       &query_string, tag_ops);
 
 	if (ret > 0)
@@ -194,7 +194,7 @@ notmuch_tag_command (void *ctx, int argc, char *argv[])
     notmuch_config_t *config;
     notmuch_database_t *notmuch;
     struct sigaction action;
-    tag_op_flag_t synchronize_flags = TAG_FLAG_NONE;
+    tag_op_flag_t tag_flags = TAG_FLAG_NONE;
     notmuch_bool_t batch = FALSE;
     FILE *input = stdin;
     char *input_file_name = NULL;
@@ -255,12 +255,12 @@ notmuch_tag_command (void *ctx, int argc, char *argv[])
 	return 1;
 
     if (notmuch_config_get_maildir_synchronize_flags (config))
-	synchronize_flags = TAG_FLAG_MAILDIR_SYNC;
+	tag_flags |= TAG_FLAG_MAILDIR_SYNC;
 
     if (batch)
-	ret = tag_file (ctx, notmuch, synchronize_flags, input);
+	ret = tag_file (ctx, notmuch, tag_flags, input);
     else
-	ret = tag_query (ctx, notmuch, query_string, tag_ops, synchronize_flags);
+	ret = tag_query (ctx, notmuch, query_string, tag_ops, tag_flags);
 
     notmuch_database_destroy (notmuch);
 

commit bf8d4de2b174cff389d5f5fe4bdd10df2323fe77
Author: David Bremner <bremner@debian.org>
Date:   Sun Dec 9 16:19:32 2012 -0400

    changes for id:87pq2tqpvq.fsf@nikula.org

diff --git a/test/tagging b/test/tagging
index 7155e47..0f3d797 100755
--- a/test/tagging
+++ b/test/tagging
@@ -59,8 +59,9 @@ test_expect_equal "$output" "\
 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag5 unread)
 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag5 unread)"
 
+# generate a common input file for the next several tests.
 cat > batch.in  <<EOF
-# %20 is a space in tag
+# %40 is an @ in tag
 +%40 -tag5 +tag6 -- One
 +tag1 -tag1 -tag4 +tag4 -- Two
 -tag5 +tag6 Two
@@ -72,18 +73,18 @@ thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag6 unread)
 EOF
 
 test_begin_subtest "--input"
-notmuch dump > backup.tags
+notmuch dump --format=batch-tag > backup.tags
 notmuch tag --input=batch.in
-notmuch search \* | notmuch_search_sanitize > OUTPUT
-notmuch restore < backup.tags
-test_expect_equal_file OUTPUT batch.expected
+notmuch search \* | notmuch_search_sanitize > OUTPUT.$test_count
+notmuch restore --format=batch-tag < backup.tags
+test_expect_equal_file batch.expected OUTPUT.$test_count
 
 test_begin_subtest "--batch --input"
-notmuch dump > backup.tags
+notmuch dump --format=batch-tag > backup.tags
 notmuch tag --batch --input=batch.in
-notmuch search \* | notmuch_search_sanitize > OUTPUT
-notmuch restore < backup.tags
-test_expect_equal_file OUTPUT batch.expected
+notmuch search \* | notmuch_search_sanitize > OUTPUT.$test_count
+notmuch restore --format=batch-tag < backup.tags
+test_expect_equal_file batch.expected OUTPUT.$test_count
 
 test_begin_subtest "--batch, blank lines and comments"
 notmuch dump | sort > EXPECTED.$test_count

commit 4fa12e718b0eaf82f26b9b8aea48f860fc5e1f72
Author: David Bremner <bremner@debian.org>
Date:   Sun Dec 9 16:24:13 2012 -0400

    changes for id:87sj7xi9j5.fsf@qmul.ac.uk and id:871uf8egi8.fsf@nikula.org

diff --git a/man/man1/notmuch-tag.1 b/man/man1/notmuch-tag.1
index 751db7b..3c15393 100644
--- a/man/man1/notmuch-tag.1
+++ b/man/man1/notmuch-tag.1
@@ -61,12 +61,12 @@ Read input from given file, instead of from stdin. Implies
 
 The input must consist of lines of the format:
 
-.RI "T +<" tag ">|\-<" tag "> [...] [\-\-] <" search-terms ">"
+.RI "+<" tag ">|\-<" tag "> [...] [\-\-] <" search-term "> [...]"
 
 Each line is interpreted similarly to
 .B notmuch tag
 command line arguments. The delimiter is one or more spaces ' '. Any
-characters in <tag> and <search-terms>
+characters in <tag> and <search-term>
 .B may
 be hex encoded with %NN where NN is the hexadecimal value of the
 character. Any ' ' and '%' characters in <tag> and <search-terms>

Thread: