--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 534EE431FB6\r
+ for <notmuch@notmuchmail.org>; Fri, 24 Jan 2014 01:00:50 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 6wF9L6Ad5Wq1 for <notmuch@notmuchmail.org>;\r
+ Fri, 24 Jan 2014 01:00:42 -0800 (PST)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 51F3E431FAF\r
+ for <notmuch@notmuchmail.org>; Fri, 24 Jan 2014 01:00:42 -0800 (PST)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1W6cch-000615-Uv; Fri, 24 Jan 2014 09:00:38 +0000\r
+Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1W6cbo-000263-CM; Fri, 24 Jan 2014 08:59:28 +0000\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 6/7] cli: add --quiet option to notmuch new\r
+In-Reply-To:\r
+ <276371280dfbf8d98a9970b68910e1c030769641.1390163335.git.jani@nikula.org>\r
+References: <cover.1390163335.git.jani@nikula.org>\r
+ <276371280dfbf8d98a9970b68910e1c030769641.1390163335.git.jani@nikula.org>\r
+User-Agent: Notmuch/0.15.2+484~gfb59956 (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Fri, 24 Jan 2014 08:58:02 +0000\r
+Message-ID: <87txctah9h.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 93.97.24.31\r
+X-QM-Geographic: According to ripencc,\r
+ this message was delivered by a machine in Britain (UK) (GB).\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: 7898fa3a61acdc79bf063ba117da7861 (of first 20000 bytes)\r
+X-SpamAssassin-Score: 0.0\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored 0.0 points. Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * 0.0 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\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: Fri, 24 Jan 2014 09:00:50 -0000\r
+\r
+\r
+Hi\r
+\r
+I am working my way through this series in a rather random order.\r
+\r
+I am not sure I like doing the database upgrade with no comment to the\r
+user at all. In fact I am not sure I like doing the upgrade without\r
+being specifically told to (e.g. it does not give the user a clear chance\r
+to backup the database first)\r
+\r
+What would people think about having a --upgrade-database option to\r
+notmuch new? \r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+ On Sun, 19 Jan 2014, Jani Nikula <jani@nikula.org> wrote:\r
+> Tie it to --verbose (resulting in verbosity levels of quiet, normal,\r
+> and verbose) but leave --debug orthogonal. Do some drive-by cleaning\r
+> while at it.\r
+> ---\r
+> notmuch-new.c | 47 ++++++++++++++++++++++++++++++++---------------\r
+> 1 file changed, 32 insertions(+), 15 deletions(-)\r
+>\r
+> diff --git a/notmuch-new.c b/notmuch-new.c\r
+> index c443181..cd74489 100644\r
+> --- a/notmuch-new.c\r
+> +++ b/notmuch-new.c\r
+> @@ -34,9 +34,15 @@ typedef struct _filename_list {\r
+> _filename_node_t **tail;\r
+> } _filename_list_t;\r
+> \r
+> +enum verbosity {\r
+> + VERBOSITY_QUIET,\r
+> + VERBOSITY_NORMAL,\r
+> + VERBOSITY_VERBOSE,\r
+> +};\r
+> +\r
+> typedef struct {\r
+> int output_is_a_tty;\r
+> - notmuch_bool_t verbose;\r
+> + enum verbosity verbosity;\r
+> notmuch_bool_t debug;\r
+> const char **new_tags;\r
+> size_t new_tags_length;\r
+> @@ -566,13 +572,11 @@ add_files (notmuch_database_t *notmuch,\r
+> \r
+> state->processed_files++;\r
+> \r
+> - if (state->verbose) {\r
+> + if (state->verbosity >= VERBOSITY_VERBOSE) {\r
+> if (state->output_is_a_tty)\r
+> printf("\r\033[K");\r
+> \r
+> - printf ("%i/%i: %s",\r
+> - state->processed_files,\r
+> - state->total_files,\r
+> + printf ("%i/%i: %s", state->processed_files, state->total_files,\r
+> next);\r
+> \r
+> putchar((state->output_is_a_tty) ? '\r' : '\n');\r
+> @@ -741,7 +745,7 @@ count_files (const char *path, int *count, add_files_state_t *state)\r
+> entry_type = dirent_type (path, entry);\r
+> if (entry_type == S_IFREG) {\r
+> *count = *count + 1;\r
+> - if (*count % 1000 == 0) {\r
+> + if (*count % 1000 == 0 && state->verbosity >= VERBOSITY_NORMAL) {\r
+> printf ("Found %d files so far.\r", *count);\r
+> fflush (stdout);\r
+> }\r
+> @@ -917,13 +921,15 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])\r
+> int i;\r
+> notmuch_bool_t timer_is_active = FALSE;\r
+> notmuch_bool_t no_hooks = FALSE;\r
+> + notmuch_bool_t quiet = FALSE, verbose = FALSE;\r
+> \r
+> - add_files_state.verbose = FALSE;\r
+> + add_files_state.verbosity = VERBOSITY_NORMAL;\r
+> add_files_state.debug = FALSE;\r
+> add_files_state.output_is_a_tty = isatty (fileno (stdout));\r
+> \r
+> notmuch_opt_desc_t options[] = {\r
+> - { NOTMUCH_OPT_BOOLEAN, &add_files_state.verbose, "verbose", 'v', 0 },\r
+> + { NOTMUCH_OPT_BOOLEAN, &quiet, "quiet", 'q', 0 },\r
+> + { NOTMUCH_OPT_BOOLEAN, &verbose, "verbose", 'v', 0 },\r
+> { NOTMUCH_OPT_BOOLEAN, &add_files_state.debug, "debug", 'd', 0 },\r
+> { NOTMUCH_OPT_BOOLEAN, &no_hooks, "no-hooks", 'n', 0 },\r
+> { 0, 0, 0, 0, 0 }\r
+> @@ -933,6 +939,12 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])\r
+> if (opt_index < 0)\r
+> return EXIT_FAILURE;\r
+> \r
+> + /* quiet trumps verbose */\r
+> + if (quiet)\r
+> + add_files_state.verbosity = VERBOSITY_QUIET;\r
+> + else if (verbose)\r
+> + add_files_state.verbosity = VERBOSITY_VERBOSE;\r
+> +\r
+> add_files_state.new_tags = notmuch_config_get_new_tags (config, &add_files_state.new_tags_length);\r
+> add_files_state.new_ignore = notmuch_config_get_new_ignore (config, &add_files_state.new_ignore_length);\r
+> add_files_state.synchronize_flags = notmuch_config_get_maildir_synchronize_flags (config);\r
+> @@ -954,7 +966,8 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])\r
+> if (interrupted)\r
+> return EXIT_FAILURE;\r
+> \r
+> - printf ("Found %d total files (that's not much mail).\n", count);\r
+> + if (add_files_state.verbosity >= VERBOSITY_NORMAL)\r
+> + printf ("Found %d total files (that's not much mail).\n", count);\r
+> if (notmuch_database_create (db_path, ¬much))\r
+> return EXIT_FAILURE;\r
+> add_files_state.total_files = count;\r
+> @@ -964,11 +977,14 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])\r
+> return EXIT_FAILURE;\r
+> \r
+> if (notmuch_database_needs_upgrade (notmuch)) {\r
+> - printf ("Welcome to a new version of notmuch! Your database will now be upgraded.\n");\r
+> + if (add_files_state.verbosity >= VERBOSITY_NORMAL)\r
+> + printf ("Welcome to a new version of notmuch! Your database will now be upgraded.\n");\r
+> gettimeofday (&add_files_state.tv_start, NULL);\r
+> - notmuch_database_upgrade (notmuch, upgrade_print_progress,\r
+> + notmuch_database_upgrade (notmuch,\r
+> + add_files_state.verbosity >= VERBOSITY_NORMAL ? upgrade_print_progress : NULL,\r
+> &add_files_state);\r
+> - printf ("Your notmuch database has now been upgraded to database format version %u.\n",\r
+> + if (add_files_state.verbosity >= VERBOSITY_NORMAL)\r
+> + printf ("Your notmuch database has now been upgraded to database format version %u.\n",\r
+> notmuch_database_get_version (notmuch));\r
+> }\r
+> \r
+> @@ -999,8 +1015,8 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])\r
+> add_files_state.removed_directories = _filename_list_create (config);\r
+> add_files_state.directory_mtimes = _filename_list_create (config);\r
+> \r
+> - if (! debugger_is_active () && add_files_state.output_is_a_tty\r
+> - && ! add_files_state.verbose) {\r
+> + if (add_files_state.verbosity == VERBOSITY_NORMAL &&\r
+> + add_files_state.output_is_a_tty && ! debugger_is_active ()) {\r
+> setup_progress_printing_timer ();\r
+> timer_is_active = TRUE;\r
+> }\r
+> @@ -1053,7 +1069,8 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])\r
+> if (timer_is_active)\r
+> stop_progress_printing_timer ();\r
+> \r
+> - print_results (&add_files_state);\r
+> + if (add_files_state.verbosity >= VERBOSITY_NORMAL)\r
+> + print_results (&add_files_state);\r
+> \r
+> if (ret)\r
+> fprintf (stderr, "Note: A fatal error was encountered: %s\n",\r
+> -- \r
+> 1.8.5.2\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r