From: Jani Nikula Date: Sat, 29 Aug 2015 14:56:34 +0000 (+0300) Subject: [RFC PATCH 3/5] cli: add support for not deduplicating notmuch address results X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6fb15a6bf0a3fc333ac848b8c35bf63188016095;p=notmuch-archives.git [RFC PATCH 3/5] cli: add support for not deduplicating notmuch address results --- diff --git a/fc/32bad1c36e638ca1e93bab7bb188c6c60faacd b/fc/32bad1c36e638ca1e93bab7bb188c6c60faacd new file mode 100644 index 000000000..771abb25d --- /dev/null +++ b/fc/32bad1c36e638ca1e93bab7bb188c6c60faacd @@ -0,0 +1,105 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id BCD566DE1642 + for ; Sat, 29 Aug 2015 07:56:55 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: -0.34 +X-Spam-Level: +X-Spam-Status: No, score=-0.34 tagged_above=-999 required=5 tests=[AWL=0.380, + RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, + RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id qOC9v2KLESAp for ; + Sat, 29 Aug 2015 07:56:54 -0700 (PDT) +Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com + [209.85.212.182]) + by arlo.cworth.org (Postfix) with ESMTPS id BF9046DE17AA + for ; Sat, 29 Aug 2015 07:56:46 -0700 (PDT) +Received: by wicne3 with SMTP id ne3so39889912wic.0 + for ; Sat, 29 Aug 2015 07:56:45 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to + :references:in-reply-to:references; + bh=VS0F33nn0W8Dq5aBj4p/4jMj4OonAboKUj6iZe5HoeE=; + b=E1rOE3DYyF5Q/C7l+3imy69Ahv2tftp+hRirrFFrnATLAvZi/3/+ef5aFZj+LKPbIY + fGnOklKaCY1UMXYjtOS9f4/k2CWJcQ4A0FBop3mCnBIDSTd3z2TJnNhEOesi5+ITS0cX + 0ibTf5EmhVzuPjbpOaShNBnyMHgbftJ7SjfHffWAql2astEAXrM19NSqIYh5BCd4dkfh + lV72tuC7qZ9fbL5QmdLDh31J0dJUq2F/W3h2ir7GF/IZGY5sLQd3Ow3yvqL4VnLBgNAh + wFhPjcaJ/4Krzmm51bz5eqN9nf2rut+HH2o6aTzqP27AaprHsx25gRKWrLdXcNecNvcW + jTfA== +X-Gm-Message-State: + ALoCoQnDccizK3Awn8LBCYh7yLJXv1ekZHlsSKPlMobB30xY/6JQbz6JTv1EIFRK8ICiSFuAz4PQ +X-Received: by 10.180.23.66 with SMTP id k2mr9903963wif.85.1440860205123; + Sat, 29 Aug 2015 07:56:45 -0700 (PDT) +Received: from localhost (mobile-access-bcee4f-131.dhcp.inet.fi. + [188.238.79.131]) + by smtp.gmail.com with ESMTPSA id p3sm8921417wib.16.2015.08.29.07.56.44 + (version=TLSv1/SSLv3 cipher=OTHER); + Sat, 29 Aug 2015 07:56:44 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [RFC PATCH 3/5] cli: add support for not deduplicating notmuch + address results +Date: Sat, 29 Aug 2015 17:56:34 +0300 +Message-Id: + <5badd1d1d46690987558dd2283efdc69be4c8c99.1440859765.git.jani@nikula.org> +X-Mailer: git-send-email 2.1.4 +In-Reply-To: +References: +In-Reply-To: +References: +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +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, 29 Aug 2015 14:56:55 -0000 + +Make it possible to use notmuch address as part of a | sort | uniq -c +pipe instead of forcing --output=count. This is useful for combining +results from multiple notmuch address queries. +--- + notmuch-search.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/notmuch-search.c b/notmuch-search.c +index 36f58eb8d54c..be8afcc0187b 100644 +--- a/notmuch-search.c ++++ b/notmuch-search.c +@@ -355,7 +355,8 @@ process_address_list (const search_context_t *ctx, + .count = 0, + }; + +- if (is_duplicate (ctx, mbx.name, mbx.addr)) ++ if ((ctx->output & OUTPUT_COUNT || ctx->dupe) && ++ is_duplicate (ctx, mbx.name, mbx.addr)) + continue; + + if (ctx->output & OUTPUT_COUNT) +@@ -755,6 +756,10 @@ notmuch_address_command (notmuch_config_t *config, int argc, char *argv[]) + (notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE }, + { "false", NOTMUCH_EXCLUDE_FALSE }, + { 0, 0 } } }, ++ { NOTMUCH_OPT_KEYWORD, &ctx->dupe, "deduplicate", 'x', ++ (notmuch_keyword_t []){ { "yes", -1 }, ++ { "no", 0 }, ++ { 0, 0 } } }, + { NOTMUCH_OPT_INHERIT, (void *) &common_options, NULL, 0, 0 }, + { NOTMUCH_OPT_INHERIT, (void *) ¬much_shared_options, NULL, 0, 0 }, + { 0, 0, 0, 0, 0 } +-- +2.1.4 +