--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 51A726DE1579\r
+ for <notmuch@notmuchmail.org>; Mon, 10 Aug 2015 12:28:24 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 1.246\r
+X-Spam-Level: *\r
+X-Spam-Status: No, score=1.246 tagged_above=-999 required=5 tests=[AWL=-0.150,\r
+ SPF_NEUTRAL=0.652, URIBL_SBL=0.644, URIBL_SBL_A=0.1] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id TULiCnjWko46 for <notmuch@notmuchmail.org>;\r
+ Mon, 10 Aug 2015 12:28:21 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 355AC6DE0244\r
+ for <notmuch@notmuchmail.org>; Mon, 10 Aug 2015 12:28:20 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id E1FEB1000CE;\r
+ Mon, 10 Aug 2015 22:28:05 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 3/5] cli/count: add --output=modifications\r
+In-Reply-To: <1439112285-6681-4-git-send-email-david@tethera.net>\r
+References: <1439112285-6681-1-git-send-email-david@tethera.net>\r
+ <1439112285-6681-4-git-send-email-david@tethera.net>\r
+User-Agent: Notmuch/0.20.2+58~ge9cd033 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Mon, 10 Aug 2015 22:28:05 +0300\r
+Message-ID: <m21tfb54fu.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\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 Aug 2015 19:28:24 -0000\r
+\r
+On Sun, Aug 09 2015, David Bremner <david@tethera.net> wrote:\r
+\r
+> We need some way to extract the uuid/revision of the database, and\r
+> count seems like the least bad choice of current commands.\r
+> The (perhaps weak) argument for count over search is that count\r
+> already reports statistics about the entire database.\r
+\r
+The '(perhaps weak)' part could be discussed outside of the commit message ;)\r
+... but read below for (IMO) "real" issues...\r
+\r
+> ---\r
+> notmuch-count.c | 18 +++++++++++++++++-\r
+> test/T570-revision-tracking.sh | 12 ++++++++++++\r
+> 2 files changed, 29 insertions(+), 1 deletion(-)\r
+>\r
+> diff --git a/notmuch-count.c b/notmuch-count.c\r
+> index 57a88a8..7c61ccb 100644\r
+> --- a/notmuch-count.c\r
+> +++ b/notmuch-count.c\r
+> @@ -25,6 +25,7 @@ enum {\r
+> OUTPUT_THREADS,\r
+> OUTPUT_MESSAGES,\r
+> OUTPUT_FILES,\r
+> + OUTPUT_LASTMOD,\r
+> };\r
+> \r
+> /* The following is to allow future options to be added more easily */\r
+> @@ -71,6 +72,9 @@ print_count (notmuch_database_t *notmuch, const char *query_str,\r
+> {\r
+> notmuch_query_t *query;\r
+> size_t i;\r
+> + unsigned long revision;\r
+> + const char *uuid;\r
+> + int ret = 0;\r
+> \r
+> query = notmuch_query_create (notmuch, query_str);\r
+> if (query == NULL) {\r
+> @@ -91,11 +95,22 @@ print_count (notmuch_database_t *notmuch, const char *query_str,\r
+> case OUTPUT_FILES:\r
+> printf ("%u\n", count_files (query));\r
+> break;\r
+> + case OUTPUT_LASTMOD:\r
+> + if (strcmp (notmuch_query_get_query_string (query), "*") != 0) {\r
+> + fprintf (stderr, "Error: Only '*' is currently supported "\r
+> + " with output=modifications\n");\r
+> + ret = 1;\r
+> + goto DONE;\r
+> + }\r
+\r
+I have three comments on this series, the first one is hardest, second\r
+trivial and one could be either way.\r
+\r
+> +\r
+> + revision = notmuch_database_get_revision (notmuch, &uuid);\r
+> + printf ("%s\t%lu\n", uuid, revision);\r
+\r
+Currently, `notmuch count` outputs lines that contain just one integer;\r
+this changes this by introducing output with uuid ([0-9a-f-]) and integer\r
+delimited by tab character.\r
+\r
+To put it lightly, this looks "inconsistent" and don't please my aesthetic\r
+eye.\r
+\r
+One option (being it worse or better) could be that by default only\r
+lastmod value is printed and with separate option it is prefixed with\r
+database UUID (in every --output option).\r
+\r
+BTW: I did not see notmuch-count.rst updated. good for now as it reduces\r
+the amount of work during this bikeshed period ;D\r
+\r
+continuing in next email...\r
+\r
+Tomi\r
+\r
+\r
+\r
+> }\r
+> \r
+> + DONE:\r
+> notmuch_query_destroy (query);\r
+> \r
+> - return 0;\r
+> + return ret;\r
+> }\r
+> \r
+> static int\r
+> @@ -139,6 +154,7 @@ notmuch_count_command (notmuch_config_t *config, int argc, char *argv[])\r
+> (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS },\r
+> { "messages", OUTPUT_MESSAGES },\r
+> { "files", OUTPUT_FILES },\r
+> + { "modifications", OUTPUT_LASTMOD },\r
+> { 0, 0 } } },\r
+> { NOTMUCH_OPT_KEYWORD, &exclude, "exclude", 'x',\r
+> (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },\r
+> diff --git a/test/T570-revision-tracking.sh b/test/T570-revision-tracking.sh\r
+> index e0a5703..008c5d0 100755\r
+> --- a/test/T570-revision-tracking.sh\r
+> +++ b/test/T570-revision-tracking.sh\r
+> @@ -34,4 +34,16 @@ UUID 53\r
+> EOF\r
+> test_expect_equal_file EXPECTED CLEAN\r
+> \r
+> +grep '^[0-9a-f]' OUTPUT > INITIAL_OUTPUT\r
+> +\r
+> +test_begin_subtest "output of count matches test code"\r
+> +notmuch count --output=modifications '*' > OUTPUT\r
+> +test_expect_equal_file INITIAL_OUTPUT OUTPUT\r
+> +\r
+> +test_begin_subtest "modification count increases"\r
+> +before=$(notmuch count --output=modifications '*' | cut -f2)\r
+> +notmuch tag +a-random-tag-8743632 '*'\r
+> +after=$(notmuch count --output=modifications '*' | cut -f2)\r
+> +result=$(($before < $after))\r
+> +test_expect_equal 1 ${result}\r
+> test_done\r
+> -- \r
+> 2.1.4\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r