Re: [PATCH v3] nmbug: Translate to Python
[notmuch-archives.git] / 16 / 5374cc32162736335836c2a8b621e050e66483
1 Return-Path: <markwalters1009@gmail.com>\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 08D11431FBC\r
6         for <notmuch@notmuchmail.org>; Sun, 17 Jun 2012 00:27:53 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.201\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
14         RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id JIPVEl9rz1hh for <notmuch@notmuchmail.org>;\r
18         Sun, 17 Jun 2012 00:27:50 -0700 (PDT)\r
19 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
20         [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id 6289F431FAE\r
23         for <notmuch@notmuchmail.org>; Sun, 17 Jun 2012 00:27:50 -0700 (PDT)\r
24 Received: by werj55 with SMTP id j55so3608086wer.26\r
25         for <notmuch@notmuchmail.org>; Sun, 17 Jun 2012 00:27:49 -0700 (PDT)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
28         bh=LCmNXoe3ZZ0LJgIv/Ryq12m/DW9HIGmad2nEMTn2WT8=;\r
29         b=s1J7lJMzYi8blB4UNFnF3ZH0jacSXnbPmA+HYE7Z4bkT7ZzjtCo33xd1K5XWqruAT5\r
30         KTDlSIN2DMKn+xhyHyTlHIY/y/vneXhlr/JaTf02Fe7yluALlfvhx+1AAaRP5XV5s21p\r
31         ADkM71OQbAKZkK5cuvAqXGouz3odmlu2zOg31VwPbJGxy+aKaWnVnLRNY9U5winu3Rmv\r
32         y5TrhV34CR6M9lFo+LmHqBX/MvD/tGdyauKbeMCDe2XuohrehDymBrNVxVprOB9dtZId\r
33         LeFoXEW+Xp2FsLA7xfbshCXrcYIMTJ1LQjuF24oiWbERHJ1IgDJng94fjOlyjmxOgC8P\r
34         qgCg==\r
35 Received: by 10.216.30.195 with SMTP id k45mr5892337wea.40.1339918068773;\r
36         Sun, 17 Jun 2012 00:27:48 -0700 (PDT)\r
37 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
38  [94.192.233.223])      by mx.google.com with ESMTPS id\r
39  gb9sm16419953wib.8.2012.06.17.00.27.47 (version=TLSv1/SSLv3 cipher=OTHER);\r
40         Sun, 17 Jun 2012 00:27:48 -0700 (PDT)\r
41 From: Mark Walters <markwalters1009@gmail.com>\r
42 To: notmuch@notmuchmail.org,\r
43         novalazy@gmail.com\r
44 Subject: [WIP 2/2] cli: add --exclude=all option to notmuch-search.c\r
45 Date: Sun, 17 Jun 2012 08:27:26 +0100\r
46 Message-Id: <1339918046-3448-2-git-send-email-markwalters1009@gmail.com>\r
47 X-Mailer: git-send-email 1.7.9.1\r
48 In-Reply-To: <1339918046-3448-1-git-send-email-markwalters1009@gmail.com>\r
49 References: <87zk82l7wp.fsf@qmul.ac.uk>\r
50         <1339918046-3448-1-git-send-email-markwalters1009@gmail.com>\r
51 X-BeenThere: notmuch@notmuchmail.org\r
52 X-Mailman-Version: 2.1.13\r
53 Precedence: list\r
54 List-Id: "Use and development of the notmuch mail system."\r
55         <notmuch.notmuchmail.org>\r
56 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
58 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
59 List-Post: <mailto:notmuch@notmuchmail.org>\r
60 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
61 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
63 X-List-Received-Date: Sun, 17 Jun 2012 07:27:53 -0000\r
64 \r
65 Add a --exclude=all option to notmuch search.\r
66 \r
67 ---\r
68  notmuch-search.c |    8 ++++++--\r
69  test/excludes    |    5 +++++\r
70  2 files changed, 11 insertions(+), 2 deletions(-)\r
71 \r
72 diff --git a/notmuch-search.c b/notmuch-search.c\r
73 index 3be296d..89b5bf9 100644\r
74 --- a/notmuch-search.c\r
75 +++ b/notmuch-search.c\r
76 @@ -420,6 +420,7 @@ enum {\r
77      EXCLUDE_TRUE,\r
78      EXCLUDE_FALSE,\r
79      EXCLUDE_FLAG,\r
80 +    EXCLUDE_ALL\r
81  };\r
82  \r
83  int\r
84 @@ -461,6 +462,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
85            (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },\r
86                                    { "false", EXCLUDE_FALSE },\r
87                                    { "flag", EXCLUDE_FLAG },\r
88 +                                  { "all", EXCLUDE_ALL },\r
89                                    { 0, 0 } } },\r
90         { NOTMUCH_OPT_INT, &offset, "offset", 'O', 0 },\r
91         { NOTMUCH_OPT_INT, &limit, "limit", 'L', 0  },\r
92 @@ -516,7 +518,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
93         exclude = EXCLUDE_FALSE;\r
94      }\r
95  \r
96 -    if (exclude == EXCLUDE_TRUE || exclude == EXCLUDE_FLAG) {\r
97 +    if (exclude != EXCLUDE_FALSE) {\r
98         const char **search_exclude_tags;\r
99         size_t search_exclude_tags_length;\r
100  \r
101 @@ -525,7 +527,9 @@ notmuch_search_command (void *ctx, int argc, char *argv[])\r
102         for (i = 0; i < search_exclude_tags_length; i++)\r
103             notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
104         if (exclude == EXCLUDE_FLAG)\r
105 -           notmuch_query_set_omit_excluded (query, FALSE);\r
106 +           notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_FALSE);\r
107 +       if (exclude == EXCLUDE_ALL)\r
108 +           notmuch_query_set_omit_excluded (query, NOTMUCH_EXCLUDE_ALL);\r
109      }\r
110  \r
111      switch (output) {\r
112 diff --git a/test/excludes b/test/excludes\r
113 index 24d653e..7be8d79 100755\r
114 --- a/test/excludes\r
115 +++ b/test/excludes\r
116 @@ -166,6 +166,11 @@ ${matching_message_ids[3]}\r
117  ${matching_message_ids[4]}\r
118  ${matching_message_ids[5]}"\r
119  \r
120 +test_begin_subtest "Search, exclude=all (thread summary)"\r
121 +output=$(notmuch search --exclude=all tag:test | notmuch_search_sanitize)\r
122 +test_expect_equal "$output" "thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; Some messages excluded: single non-excluded match: reply 4 (inbox test unread)\r
123 +thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; No messages excluded: single match: reply 3 (inbox test unread)"\r
124 +\r
125  test_begin_subtest "Search, default exclusion: tag in query (thread summary)"\r
126  output=$(notmuch search tag:test and tag:deleted | notmuch_search_sanitize)\r
127  test_expect_equal "$output" "thread:XXX   2001-01-05 [1/6] Notmuch Test Suite; All messages excluded: single match: reply 2 (deleted inbox test unread)\r
128 -- \r
129 1.7.9.1\r
130 \r