From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 5217F431FB6 for ; Sun, 9 Dec 2012 17:00:07 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MlbnjdaPVx1L for ; Sun, 9 Dec 2012 17:00:05 -0800 (PST) Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 38A60431FAF for ; Sun, 9 Dec 2012 17:00:05 -0800 (PST) Received: from fctnnbsc30w-142167090129.dhcp-dynamic.fibreop.nb.bellaliant.net ([142.167.90.129] helo=zancas.localnet) by tesseract.cs.unb.ca with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1Thrj0-0007aU-2R; Sun, 09 Dec 2012 21:00:04 -0400 Received: from bremner by zancas.localnet with local (Exim 4.80) (envelope-from ) id 1Thriu-0003Dr-G2; Sun, 09 Dec 2012 20:59:56 -0400 From: David Bremner To: notmuch@notmuchmail.org Subject: Re: V6 batch tagging patches. In-Reply-To: <1355096008-4544-1-git-send-email-david@tethera.net> References: <1355096008-4544-1-git-send-email-david@tethera.net> User-Agent: Notmuch/0.14+151~g9a98977 (http://notmuchmail.org) Emacs/24.1.1 (x86_64-pc-linux-gnu) Date: Sun, 09 Dec 2012 20:59:56 -0400 Message-ID: <87obi2pvqr.fsf@zancas.localnet> MIME-Version: 1.0 Content-Type: text/plain X-Spam_bar: - X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Dec 2012 01:00:07 -0000 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 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 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 < 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 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 and +characters in and .B may be hex encoded with %NN where NN is the hexadecimal value of the character. Any ' ' and '%' characters in and