From f3fc3835b43005bfc1f16655b078be05f851a875 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Sun, 23 Mar 2014 15:12:47 +0200 Subject: [PATCH] Re: [PATCH 1/2] config: add key database.upgrades --- d0/2424243fbeb82b9b14bf669dacca3ee2d5d891 | 229 ++++++++++++++++++++++ 1 file changed, 229 insertions(+) create mode 100644 d0/2424243fbeb82b9b14bf669dacca3ee2d5d891 diff --git a/d0/2424243fbeb82b9b14bf669dacca3ee2d5d891 b/d0/2424243fbeb82b9b14bf669dacca3ee2d5d891 new file mode 100644 index 000000000..d3024f566 --- /dev/null +++ b/d0/2424243fbeb82b9b14bf669dacca3ee2d5d891 @@ -0,0 +1,229 @@ +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 1BF89431FBD + for ; Sun, 23 Mar 2014 06:13:00 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[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 0shxEmHRDavl for ; + Sun, 23 Mar 2014 06:12:52 -0700 (PDT) +Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com + [74.125.83.49]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + 5243A431FB6 for ; Sun, 23 Mar 2014 06:12:52 -0700 + (PDT) +Received: by mail-ee0-f49.google.com with SMTP id c41so3416931eek.22 + for ; Sun, 23 Mar 2014 06:12:50 -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:subject:in-reply-to:references + :user-agent:date:message-id:mime-version:content-type; + bh=O2mrJPjJ5xhGEzHGlPMY8BYDiV1K3S+dllokH3VQUl0=; + b=coQ5K4T7FL0pExwavtfvJpNrfQuPtBWnzv45HBwCFphIsc/MzL0u5uQVDRl2ImDh/j + 0z4D+QtPoreYDf48VlSDxuWKu9/1zF0iCeL+hDO+c8rNvWGTRnmKVXE0HrogcYg4/6QO + jatv5r/3ZDjtuq23x5t2a+MYK9uze0PyX/eUxVD3zTD/R9NeMoW2KnUhZX/rcpYTkovB + oYsarS+Wnz8+ZCR9qnXtnzTj8DLy+AeDl4/H56dqcr5tjCNSm26PiH2Hp67vOQ6o6+d9 + +dqaNGZkpRfr22qnLRp29dzJKXrcs2a4Fvc3KFlEORtj014FYWrIxWc6kcB+tiHrgzeQ + Lm9Q== +X-Gm-Message-State: + ALoCoQn0lhyV2VuAD7k3QoRcCWpq44B9NiR0tNFDSsKr8XDnWnGIir+2L9oIWKa2ltKf3sCJgf8H +X-Received: by 10.15.51.141 with SMTP id n13mr18996241eew.17.1395580369653; + Sun, 23 Mar 2014 06:12:49 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. + [88.195.111.91]) + by mx.google.com with ESMTPSA id a42sm7841451ees.10.2014.03.23.06.12.48 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Sun, 23 Mar 2014 06:12:48 -0700 (PDT) +From: Jani Nikula +To: David Bremner , notmuch@notmuchmail.org +Subject: Re: [PATCH 1/2] config: add key database.upgrades +In-Reply-To: <1395541573-2417-2-git-send-email-david@tethera.net> +References: <87bnx4jyyp.fsf@servo.finestructure.net> + <1395541573-2417-1-git-send-email-david@tethera.net> + <1395541573-2417-2-git-send-email-david@tethera.net> +User-Agent: Notmuch/0.17+149~g6de65e9791bc (http://notmuchmail.org) + Emacs/24.3.1 (x86_64-pc-linux-gnu) +Date: Sun, 23 Mar 2014 15:12:47 +0200 +Message-ID: <87siq9rrcg.fsf@nikula.org> +MIME-Version: 1.0 +Content-Type: text/plain +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: Sun, 23 Mar 2014 13:13:00 -0000 + +On Sun, 23 Mar 2014, David Bremner wrote: +> The intent is to allow the user to enable or disable automatic +> database upgrades. +> +> This doesn't do anything yet. +> --- +> doc/man1/notmuch-config.rst | 4 ++++ +> notmuch-client.h | 7 +++++++ +> notmuch-config.c | 34 +++++++++++++++++++++++++++++----- +> test/T030-config.sh | 1 + +> test/T040-setup.sh | 1 + +> 5 files changed, 42 insertions(+), 5 deletions(-) +> +> diff --git a/doc/man1/notmuch-config.rst b/doc/man1/notmuch-config.rst +> index 3c9a568..fc7fab6 100644 +> --- a/doc/man1/notmuch-config.rst +> +++ b/doc/man1/notmuch-config.rst +> @@ -49,6 +49,10 @@ The available configuration items are described below. +> within a sub-directory of the path configured here named +> ``.notmuch``. +> +> + **database.upgrades** +> + Set to ``yes`` to enable automatic in-place upgrades of the notmuch +> + database. +> + +> **user.name** +> Your full name. +> +> diff --git a/notmuch-client.h b/notmuch-client.h +> index 278b498..3891a82 100644 +> --- a/notmuch-client.h +> +++ b/notmuch-client.h +> @@ -275,6 +275,13 @@ notmuch_config_set_database_path (notmuch_config_t *config, +> const char *database_path); +> +> const char * +> +notmuch_config_get_database_upgrades (notmuch_config_t *config); +> + +> +void +> +notmuch_config_set_database_upgrades (notmuch_config_t *config, +> + const char *database_upgrades); + +I'm opposed to adding a config option for this, but if you're going to +do it anyway, please at least make it a bool. See synchronize flags +option. + +BR, +Jani. + +> + +> +const char * +> notmuch_config_get_user_name (notmuch_config_t *config); +> +> void +> diff --git a/notmuch-config.c b/notmuch-config.c +> index 8d28653..8f4ce99 100644 +> --- a/notmuch-config.c +> +++ b/notmuch-config.c +> @@ -32,11 +32,16 @@ static const char toplevel_config_comment[] = +> static const char database_config_comment[] = +> " Database configuration\n" +> "\n" +> - " The only value supported here is 'path' which should be the top-level\n" +> - " directory where your mail currently exists and to where mail will be\n" +> - " delivered in the future. Files should be individual email messages.\n" +> - " Notmuch will store its database within a sub-directory of the path\n" +> - " configured here named \".notmuch\".\n"; +> + "The following options are supported here:\n" +> + "\n" +> + "\tpath The top-level directory where your mail currently exists\n" +> + "\t and to where mail will be delivered in the future. Files\n" +> + "\t should be individual email messages. Notmuch will store\n" +> + "\t its database within a sub-directory (named .notmuch) of\n" +> + "\t the path configured here.\n" +> + "\n" +> + "\tupgrades Set to 'yes' to enable automatic database upgrades.\n" +> + "\n"; +> +> static const char new_config_comment[] = +> " Configuration for \"notmuch new\"\n" +> @@ -107,6 +112,7 @@ struct _notmuch_config { +> notmuch_bool_t is_new; +> +> char *database_path; +> + char *database_upgrades; +> char *user_name; +> char *user_primary_email; +> const char **user_other_email; +> @@ -265,6 +271,7 @@ notmuch_config_open (void *ctx, +> +> config->is_new = FALSE; +> config->database_path = NULL; +> + config->database_upgrades = NULL; +> config->user_name = NULL; +> config->user_primary_email = NULL; +> config->user_other_email = NULL; +> @@ -328,6 +335,10 @@ notmuch_config_open (void *ctx, +> talloc_free (path); +> } +> +> + if (notmuch_config_get_database_upgrades (config) == NULL) { +> + notmuch_config_set_database_upgrades (config, "no"); +> + } +> + +> if (notmuch_config_get_user_name (config) == NULL) { +> char *name = get_name_from_passwd_file (config); +> notmuch_config_set_user_name (config, name); +> @@ -582,6 +593,19 @@ notmuch_config_set_database_path (notmuch_config_t *config, +> } +> +> const char * +> +notmuch_config_get_database_upgrades (notmuch_config_t *config) +> +{ +> + return _config_get (config, &config->database_upgrades, "database", "upgrades"); +> +} +> + +> +void +> +notmuch_config_set_database_upgrades (notmuch_config_t *config, +> + const char *database_upgrades) +> +{ +> + _config_set (config, &config->database_upgrades, "database", "upgrades", database_upgrades); +> +} +> + +> +const char * +> notmuch_config_get_user_name (notmuch_config_t *config) +> { +> return _config_get (config, &config->user_name, "user", "name"); +> diff --git a/test/T030-config.sh b/test/T030-config.sh +> index ca4cf33..d095f0e 100755 +> --- a/test/T030-config.sh +> +++ b/test/T030-config.sh +> @@ -47,6 +47,7 @@ notmuch config set database.path "/canonical/path" +> output=$(notmuch config list) +> test_expect_equal "$output" "\ +> database.path=/canonical/path +> +database.upgrades=no +> user.name=Notmuch Test Suite +> user.primary_email=test_suite@notmuchmail.org +> user.other_email=test_suite_other@notmuchmail.org;test_suite@otherdomain.org +> diff --git a/test/T040-setup.sh b/test/T040-setup.sh +> index 124ef1c..46fd327 100755 +> --- a/test/T040-setup.sh +> +++ b/test/T040-setup.sh +> @@ -16,6 +16,7 @@ EOF +> output=$(notmuch --config=new-notmuch-config config list) +> test_expect_equal "$output" "\ +> database.path=/path/to/maildir +> +database.upgrades=no +> user.name=Test Suite +> user.primary_email=test.suite@example.com +> user.other_email=another.suite@example.com; +> -- +> 1.9.0 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2