Re: V6 batch tagging patches.
authorDavid Bremner <david@tethera.net>
Mon, 10 Dec 2012 00:59:56 +0000 (20:59 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:51:56 +0000 (09:51 -0800)
66/97295255f6f78d59d017d95d7389fc8445eab9 [new file with mode: 0644]

diff --git a/66/97295255f6f78d59d017d95d7389fc8445eab9 b/66/97295255f6f78d59d017d95d7389fc8445eab9
new file mode 100644 (file)
index 0000000..896ffc2
--- /dev/null
@@ -0,0 +1,188 @@
+Return-Path: <bremner@unb.ca>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 5217F431FB6\r
+       for <notmuch@notmuchmail.org>; Sun,  9 Dec 2012 17:00:07 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id MlbnjdaPVx1L for <notmuch@notmuchmail.org>;\r
+       Sun,  9 Dec 2012 17:00:05 -0800 (PST)\r
+Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238])\r
+       (using TLSv1 with cipher AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 38A60431FAF\r
+       for <notmuch@notmuchmail.org>; Sun,  9 Dec 2012 17:00:05 -0800 (PST)\r
+Received: from fctnnbsc30w-142167090129.dhcp-dynamic.fibreop.nb.bellaliant.net\r
+       ([142.167.90.129] helo=zancas.localnet)\r
+       by tesseract.cs.unb.ca with esmtpsa\r
+       (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72)\r
+       (envelope-from <bremner@unb.ca>)\r
+       id 1Thrj0-0007aU-2R; Sun, 09 Dec 2012 21:00:04 -0400\r
+Received: from bremner by zancas.localnet with local (Exim 4.80)\r
+       (envelope-from <bremner@unb.ca>)\r
+       id 1Thriu-0003Dr-G2; Sun, 09 Dec 2012 20:59:56 -0400\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: Re: V6 batch tagging patches.\r
+In-Reply-To: <1355096008-4544-1-git-send-email-david@tethera.net>\r
+References: <1355096008-4544-1-git-send-email-david@tethera.net>\r
+User-Agent: Notmuch/0.14+151~g9a98977 (http://notmuchmail.org) Emacs/24.1.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Sun, 09 Dec 2012 20:59:56 -0400\r
+Message-ID: <87obi2pvqr.fsf@zancas.localnet>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-Spam_bar: -\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 10 Dec 2012 01:00:07 -0000\r
+\r
+david@tethera.net writes:\r
+\r
+> This obsoletes the remaining patches in \r
+>\r
+>      id:1353792017-31459-1-git-send-email-david@tethera.net\r
+>\r
+> This isn't really v6 of these particular patches, but oh well.\r
+\r
+I forgot to mention that I will probably add some more tests; several of\r
+the dump/restore batch-tag format tests can be re-used.\r
+\r
+Here is a log of changes for the last set of reviews.\r
+\r
+commit 120b1aef754cbe969e0421d5557f0308381f73d2\r
+Author: David Bremner <bremner@debian.org>\r
+Date:   Sun Dec 9 15:57:10 2012 -0400\r
+\r
+    fixup for id:87txs5qqeb.fsf@nikula.org\r
+\r
+diff --git a/notmuch-tag.c b/notmuch-tag.c\r
+index dbd98a0..b8732f6 100644\r
+--- a/notmuch-tag.c\r
++++ b/notmuch-tag.c\r
+@@ -169,7 +169,7 @@ tag_file (void *ctx, notmuch_database_t *notmuch, tag_op_flag_t flags,\r
+     while ((line_len = getline (&line, &line_size, input)) != -1 &&\r
+          ! interrupted) {\r
\r
+-      ret =  parse_tag_line (ctx, line, TAG_FLAG_NONE,\r
++      ret = parse_tag_line (ctx, line, TAG_FLAG_NONE,\r
+                              &query_string, tag_ops);\r
\r
+       if (ret > 0)\r
+@@ -194,7 +194,7 @@ notmuch_tag_command (void *ctx, int argc, char *argv[])\r
+     notmuch_config_t *config;\r
+     notmuch_database_t *notmuch;\r
+     struct sigaction action;\r
+-    tag_op_flag_t synchronize_flags = TAG_FLAG_NONE;\r
++    tag_op_flag_t tag_flags = TAG_FLAG_NONE;\r
+     notmuch_bool_t batch = FALSE;\r
+     FILE *input = stdin;\r
+     char *input_file_name = NULL;\r
+@@ -255,12 +255,12 @@ notmuch_tag_command (void *ctx, int argc, char *argv[])\r
+       return 1;\r
\r
+     if (notmuch_config_get_maildir_synchronize_flags (config))\r
+-      synchronize_flags = TAG_FLAG_MAILDIR_SYNC;\r
++      tag_flags |= TAG_FLAG_MAILDIR_SYNC;\r
\r
+     if (batch)\r
+-      ret = tag_file (ctx, notmuch, synchronize_flags, input);\r
++      ret = tag_file (ctx, notmuch, tag_flags, input);\r
+     else\r
+-      ret = tag_query (ctx, notmuch, query_string, tag_ops, synchronize_flags);\r
++      ret = tag_query (ctx, notmuch, query_string, tag_ops, tag_flags);\r
\r
+     notmuch_database_destroy (notmuch);\r
\r
+\r
+commit bf8d4de2b174cff389d5f5fe4bdd10df2323fe77\r
+Author: David Bremner <bremner@debian.org>\r
+Date:   Sun Dec 9 16:19:32 2012 -0400\r
+\r
+    changes for id:87pq2tqpvq.fsf@nikula.org\r
+\r
+diff --git a/test/tagging b/test/tagging\r
+index 7155e47..0f3d797 100755\r
+--- a/test/tagging\r
++++ b/test/tagging\r
+@@ -59,8 +59,9 @@ test_expect_equal "$output" "\\r
+ thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag5 unread)\r
+ thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag5 unread)"\r
\r
++# generate a common input file for the next several tests.\r
+ cat > batch.in  <<EOF\r
+-# %20 is a space in tag\r
++# %40 is an @ in tag\r
+ +%40 -tag5 +tag6 -- One\r
+ +tag1 -tag1 -tag4 +tag4 -- Two\r
+ -tag5 +tag6 Two\r
+@@ -72,18 +73,18 @@ thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag6 unread)\r
+ EOF\r
\r
+ test_begin_subtest "--input"\r
+-notmuch dump > backup.tags\r
++notmuch dump --format=batch-tag > backup.tags\r
+ notmuch tag --input=batch.in\r
+-notmuch search \* | notmuch_search_sanitize > OUTPUT\r
+-notmuch restore < backup.tags\r
+-test_expect_equal_file OUTPUT batch.expected\r
++notmuch search \* | notmuch_search_sanitize > OUTPUT.$test_count\r
++notmuch restore --format=batch-tag < backup.tags\r
++test_expect_equal_file batch.expected OUTPUT.$test_count\r
\r
+ test_begin_subtest "--batch --input"\r
+-notmuch dump > backup.tags\r
++notmuch dump --format=batch-tag > backup.tags\r
+ notmuch tag --batch --input=batch.in\r
+-notmuch search \* | notmuch_search_sanitize > OUTPUT\r
+-notmuch restore < backup.tags\r
+-test_expect_equal_file OUTPUT batch.expected\r
++notmuch search \* | notmuch_search_sanitize > OUTPUT.$test_count\r
++notmuch restore --format=batch-tag < backup.tags\r
++test_expect_equal_file batch.expected OUTPUT.$test_count\r
\r
+ test_begin_subtest "--batch, blank lines and comments"\r
+ notmuch dump | sort > EXPECTED.$test_count\r
+\r
+commit 4fa12e718b0eaf82f26b9b8aea48f860fc5e1f72\r
+Author: David Bremner <bremner@debian.org>\r
+Date:   Sun Dec 9 16:24:13 2012 -0400\r
+\r
+    changes for id:87sj7xi9j5.fsf@qmul.ac.uk and id:871uf8egi8.fsf@nikula.org\r
+\r
+diff --git a/man/man1/notmuch-tag.1 b/man/man1/notmuch-tag.1\r
+index 751db7b..3c15393 100644\r
+--- a/man/man1/notmuch-tag.1\r
++++ b/man/man1/notmuch-tag.1\r
+@@ -61,12 +61,12 @@ Read input from given file, instead of from stdin. Implies\r
\r
+ The input must consist of lines of the format:\r
\r
+-.RI "T +<" tag ">|\-<" tag "> [...] [\-\-] <" search-terms ">"\r
++.RI "+<" tag ">|\-<" tag "> [...] [\-\-] <" search-term "> [...]"\r
\r
+ Each line is interpreted similarly to\r
+ .B notmuch tag\r
+ command line arguments. The delimiter is one or more spaces ' '. Any\r
+-characters in <tag> and <search-terms>\r
++characters in <tag> and <search-term>\r
+ .B may\r
+ be hex encoded with %NN where NN is the hexadecimal value of the\r
+ character. Any ' ' and '%' characters in <tag> and <search-terms>\r