From: Mark Walters Date: Sat, 3 Mar 2012 13:05:15 +0000 (+0000) Subject: [PATCH 2/5] cli: move count to the new --with-excluded naming scheme. X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=04a3dc0fb413b8e9d5d64cbcaf02cbd18393e7d8;p=notmuch-archives.git [PATCH 2/5] cli: move count to the new --with-excluded naming scheme. --- diff --git a/bc/ca723199f62b1300b44a3e0f2c647801c3c9cd b/bc/ca723199f62b1300b44a3e0f2c647801c3c9cd new file mode 100644 index 000000000..3b503fff5 --- /dev/null +++ b/bc/ca723199f62b1300b44a3e0f2c647801c3c9cd @@ -0,0 +1,151 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 56F0B431FC0 + for ; Sat, 3 Mar 2012 05:04:07 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + RCVD_IN_DNSWL_LOW=-0.7] 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 O5F1Nx+G3iCl for ; + Sat, 3 Mar 2012 05:04:05 -0800 (PST) +Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com + [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + DE01F431FDE for ; Sat, 3 Mar 2012 05:04:02 -0800 + (PST) +Received: by wgbds10 with SMTP id ds10so171103wgb.2 + for ; Sat, 03 Mar 2012 05:04:01 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; + bh=O6C+JZcOtaI4lvW+H4RgTr4s5UDAihljkrOYOPC37YI=; + b=PaHsbNmB+djeBNiTzhxyi4V1Ti7gW0wdK3uuF3dlzY7HWvs7LCfrXpnFzoy3bh91H2 + cauM5u7BLiK3vel/b8aDXycdCs0Q8ojBq0HJs/FIUz3py86F5DT0FQt9gEiEqtBBnDzS + 7967qSjhkTH0ZQeFZWjdN0rh5I8tXePsGxUAtHX85VmhbYMJ0Fwvv25McVyjJIehndyL + k9TVusxFFVULnf/iT0TILIvRohxYVwV3XqbbLFwAeTaSqycxQ1N04OLLQ4Ofa8apWanN + 01K0cM8aSlYOVJVfIZnbNz8gYRWu/3QUgIe7ZdRSu1mZQL0tDyRXRr7EC7vT93EkJ/Pe + qKyA== +Received: by 10.180.78.233 with SMTP id e9mr3097892wix.0.1330779841596; + Sat, 03 Mar 2012 05:04:01 -0800 (PST) +Received: from localhost (94-192-233-223.zone6.bethere.co.uk. + [94.192.233.223]) by mx.google.com with ESMTPS id + fl2sm27089105wib.4.2012.03.03.05.04.00 (version=TLSv1/SSLv3 cipher=OTHER); + Sat, 03 Mar 2012 05:04:00 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH 2/5] cli: move count to the new --with-excluded naming scheme. +Date: Sat, 3 Mar 2012 13:05:15 +0000 +Message-Id: <1330779918-28024-3-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.2.3 +In-Reply-To: <1330779918-28024-1-git-send-email-markwalters1009@gmail.com> +References: <1330779918-28024-1-git-send-email-markwalters1009@gmail.com> +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: Sat, 03 Mar 2012 13:04:07 -0000 + +Rename the option --no-exclude to --with-excluded. Note that this +could be implemented by setting +notmuch_query_set_with_excluded_messages but it is simpler not to set +the exclude tags in the first place (the two methods give identical +output). +--- + man/man1/notmuch-count.1 | 4 ++-- + notmuch-count.c | 11 ++++++----- + test/count | 4 ++-- + 3 files changed, 10 insertions(+), 9 deletions(-) + +diff --git a/man/man1/notmuch-count.1 b/man/man1/notmuch-count.1 +index 805a8ae..5903074 100644 +--- a/man/man1/notmuch-count.1 ++++ b/man/man1/notmuch-count.1 +@@ -41,9 +41,9 @@ Output the number of matching threads. + + .RS 4 + .TP 4 +-.BR \-\-no\-exclude ++.BR \-\-with\-excluded + +-Do not exclude the messages matching search.exclude_tags in the config file. ++Include messages which match search.exclude_tags in the count. + .RE + .RE + .RE +diff --git a/notmuch-count.c b/notmuch-count.c +index 46b76ae..b87cdca 100644 +--- a/notmuch-count.c ++++ b/notmuch-count.c +@@ -35,7 +35,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) + char *query_str; + int opt_index; + int output = OUTPUT_MESSAGES; +- notmuch_bool_t no_exclude = FALSE; ++ notmuch_bool_t with_excluded = FALSE; + unsigned int i; + + notmuch_opt_desc_t options[] = { +@@ -43,7 +43,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) + (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS }, + { "messages", OUTPUT_MESSAGES }, + { 0, 0 } } }, +- { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 }, ++ { NOTMUCH_OPT_BOOLEAN, &with_excluded, "with-excluded", 'd', 0 }, + { 0, 0, 0, 0, 0 } + }; + +@@ -78,7 +78,10 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) + return 1; + } + +- if (!no_exclude) { ++ /* If we have --with-excluded we could use ++ * notmuch_query_set_with_excluded, but it is simpler not to set ++ * the exclude tags in the first place */ ++ if (!with_excluded) { + const char **search_exclude_tags; + size_t search_exclude_tags_length; + +@@ -88,8 +91,6 @@ notmuch_count_command (void *ctx, int argc, char *argv[]) + notmuch_query_add_tag_exclude (query, search_exclude_tags[i]); + } + +- notmuch_query_set_omit_excluded_messages (query, TRUE); +- + switch (output) { + case OUTPUT_MESSAGES: + printf ("%u\n", notmuch_query_count_messages (query)); +diff --git a/test/count b/test/count +index 976fff1..f74413b 100755 +--- a/test/count ++++ b/test/count +@@ -53,9 +53,9 @@ test_expect_equal \ + "1" \ + "`notmuch count subject:deleted and tag:deleted`" + +-test_begin_subtest "count \"deleted\" messages, with --no-exclude" ++test_begin_subtest "count \"deleted\" messages, with --with-excluded" + test_expect_equal \ + "3" \ +- "`notmuch count --no-exclude subject:deleted`" ++ "`notmuch count --with-excluded subject:deleted`" + + test_done +-- +1.7.2.3 +