Re: [PATCH 9/9] add has: query prefix to search for specific properties
[notmuch-archives.git] / 12 / 5a77132e7ece53da8dd77023ef55c9b0984ba4
1 Return-Path: <amdragon@mit.edu>\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 B6F59431FBF\r
6         for <notmuch@notmuchmail.org>; Tue,  1 Apr 2014 20:35:50 -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.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id cWBBwKR9oUPu for <notmuch@notmuchmail.org>;\r
16         Tue,  1 Apr 2014 20:35:46 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-6.mit.edu (dmz-mailsec-scanner-6.mit.edu\r
18         [18.7.68.35])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 05F9C431FBD\r
22         for <notmuch@notmuchmail.org>; Tue,  1 Apr 2014 20:35:45 -0700 (PDT)\r
23 X-AuditID: 12074423-f79476d000000c51-1e-533b85901910\r
24 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
25         (using TLS with cipher AES256-SHA (256/256 bits))\r
26         (Client did not present a certificate)\r
27         by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP\r
28         id BC.0E.03153.0958B335; Tue,  1 Apr 2014 23:35:44 -0400 (EDT)\r
29 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
30         by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id s323Zil7021060; \r
31         Tue, 1 Apr 2014 23:35:44 -0400\r
32 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
33         (authenticated bits=0)\r
34         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
35         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s323Zgo1010340\r
36         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
37         Tue, 1 Apr 2014 23:35:43 -0400\r
38 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
39         (envelope-from <amdragon@mit.edu>)\r
40         id 1WVBxm-0004d3-BF; Tue, 01 Apr 2014 23:35:42 -0400\r
41 Date: Tue, 1 Apr 2014 23:35:42 -0400\r
42 From: Austin Clements <amdragon@MIT.EDU>\r
43 To: David Bremner <david@tethera.net>\r
44 Subject: Re: [Patch v5 5/6] notmuch-new: backup tags before database upgrade\r
45 Message-ID: <20140402033542.GC25677@mit.edu>\r
46 References: <1396401381-18128-1-git-send-email-david@tethera.net>\r
47         <1396401381-18128-6-git-send-email-david@tethera.net>\r
48 MIME-Version: 1.0\r
49 Content-Type: text/plain; charset=us-ascii\r
50 Content-Disposition: inline\r
51 In-Reply-To: <1396401381-18128-6-git-send-email-david@tethera.net>\r
52 User-Agent: Mutt/1.5.21 (2010-09-15)\r
53 X-Brightmail-Tracker:\r
54  H4sIAAAAAAAAA+NgFmpileLIzCtJLcpLzFFi42IR4hTV1p3Qah1ssG2bicWN1m5Gi+s3ZzI7\r
55         MHk8W3WL2WPLoffMAUxRXDYpqTmZZalF+nYJXBl/W++xFRyUrFj5eCVzA+NH4S5GTg4JAROJ\r
56         m8/+M0LYYhIX7q1n62Lk4hASmM0ksX7KBSYIZwOjxIK29+wQzikmieurNkCVLWGUePz8I2sX\r
57         IwcHi4CKxMMJKiCj2AQ0JLbtXw42VkRAVeLqtslsIDazgLTEt9/NTCC2sICPxNl/FxhBWnkF\r
58         dCRW/VYDCQsJVEp83XSAGcTmFRCUODnzCQtEq5bEjX8vmUDKQcYs/8cBEuYUcJLoOzgFbJMo\r
59         0AFTTm5jm8AoNAtJ9ywk3bMQuhcwMq9ilE3JrdLNTczMKU5N1i1OTszLSy3SNdPLzSzRS00p\r
60         3cQICmp2F+UdjH8OKh1iFOBgVOLhlbhkFSzEmlhWXJl7iFGSg0lJlJcj2DpYiC8pP6UyI7E4\r
61         I76oNCe1+BCjBAezkgjvd1+gHG9KYmVValE+TEqag0VJnPetNdAkgfTEktTs1NSC1CKYrAwH\r
62         h5IE74sWoEbBotT01Iq0zJwShDQTByfIcB6g4e9BaniLCxJzizPTIfKnGBWlxHlfgiQEQBIZ\r
63         pXlwvbCk84pRHOgVYd5/IFU8wIQF1/0KaDAT0GDudVYgg0sSEVJSDYx7pZfszPbJ4OXXXs5b\r
64         ssEma8l73jlMi/1e6dpGOa6a+vz+Ku3Hv3r/Wb2X+3vEb+932copKx+uvBFaPpv7yK2H0fPf\r
65         Zv7qSD106c0rOYuOy7f+bvkrntqrn26g8t9XekZDmtAR3yI25XyXRS6+WTv2vjBLqkhSD1wt\r
66         r8K8qp/prMmd/IfX01OVWIozEg21mIuKEwGUO3diFQMAAA==\r
67 Cc: notmuch@notmuchmail.org\r
68 X-BeenThere: notmuch@notmuchmail.org\r
69 X-Mailman-Version: 2.1.13\r
70 Precedence: list\r
71 List-Id: "Use and development of the notmuch mail system."\r
72         <notmuch.notmuchmail.org>\r
73 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
74         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
75 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
76 List-Post: <mailto:notmuch@notmuchmail.org>\r
77 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
78 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
79         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
80 X-List-Received-Date: Wed, 02 Apr 2014 03:35:50 -0000\r
81 \r
82 Quoth David Bremner on Apr 01 at 10:16 pm:\r
83 > All we do here is calculate the backup filename, and call the existing\r
84 > dump routine.\r
85\r
86 > Also take the opportity to add a message about being safe to\r
87 > interrupt.\r
88 > ---\r
89 >  notmuch-new.c        | 29 ++++++++++++++++++++++++++++-\r
90 >  test/T530-upgrade.sh |  4 +++-\r
91 >  2 files changed, 31 insertions(+), 2 deletions(-)\r
92\r
93 > diff --git a/notmuch-new.c b/notmuch-new.c\r
94 > index 82acf69..e0431c6 100644\r
95 > --- a/notmuch-new.c\r
96 > +++ b/notmuch-new.c\r
97 > @@ -989,8 +989,35 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])\r
98 >           return EXIT_FAILURE;\r
99 >  \r
100 >       if (notmuch_database_needs_upgrade (notmuch)) {\r
101 > -         if (add_files_state.verbosity >= VERBOSITY_NORMAL)\r
102 > +         time_t now = time (NULL);\r
103 > +         struct tm *gm_time = gmtime (&now);\r
104 > +\r
105 > +         /* since dump files are written atomically, the amount of\r
106 > +          * harm from overwriting one within a second seems\r
107 > +          * relatively small. */\r
108 > +\r
109 > +         const char *backup_name =\r
110 > +             talloc_asprintf (notmuch, "%s/backup-%04d-%02d-%02d-%02d:%02d:%02d.gz",\r
111 \r
112 Maybe "dump" instead of "backup" so it's more obvious that it's a\r
113 notmuch dump?\r
114 \r
115 This would be ISO 8601 compatible if you put a 'T' instead of a '-'\r
116 between the date and the time.\r
117 \r
118 Colons tend to get file names into trouble (some file systems don't\r
119 support them, tools like scp think they demarcate host names, etc).\r
120 How about compact ISO 8601: dump-%04d%02d%02dT%02d%02d%02d.gz?\r
121 \r
122 > +                              dot_notmuch_path,\r
123 > +                              gm_time->tm_year + 1900,\r
124 > +                              gm_time->tm_mon + 1,\r
125 > +                              gm_time->tm_mday,\r
126 > +                              gm_time->tm_hour,\r
127 > +                              gm_time->tm_min,\r
128 > +                              gm_time->tm_sec);\r
129 > +\r
130 > +         if (add_files_state.verbosity >= VERBOSITY_NORMAL) {\r
131 >               printf ("Welcome to a new version of notmuch! Your database will now be upgraded.\n");\r
132 > +             printf ("This process is safe to interrupt.\n");\r
133 > +             printf ("Backing up tags to %s\n", backup_name);\r
134 \r
135 Add "..." to indicate a running process?  Even better would be a\r
136 progress report, but we can add that to TODO.\r
137 \r
138 > +         }\r
139 > +\r
140 > +         if (notmuch_database_dump (notmuch, backup_name, "",\r
141 > +                                    DUMP_FORMAT_BATCH_TAG, TRUE)) {\r
142 > +             fprintf (stderr, "Backup failed. Aborting upgrade");\r
143 \r
144 Add a "." at the end for consistency.\r
145 \r
146 > +             return EXIT_FAILURE;\r
147 > +         }\r
148 > +\r
149 >           gettimeofday (&add_files_state.tv_start, NULL);\r
150 >           notmuch_database_upgrade (notmuch,\r
151 >                                     add_files_state.verbosity >= VERBOSITY_NORMAL ? upgrade_print_progress : NULL,\r
152 > diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh\r
153 > index 67bbf31..d46e3d1 100755\r
154 > --- a/test/T530-upgrade.sh\r
155 > +++ b/test/T530-upgrade.sh\r
156 > @@ -26,9 +26,11 @@ output=$(notmuch search path:foo)\r
157 >  test_expect_equal "$output" ""\r
158 >  \r
159 >  test_begin_subtest "database upgrade from format version 1"\r
160 > -output=$(notmuch new)\r
161 > +output=$(notmuch new | sed -e 's/^Backing up tags to .*$/Backing up tags to FILENAME/')\r
162 >  test_expect_equal "$output" "\\r
163 >  Welcome to a new version of notmuch! Your database will now be upgraded.\r
164 > +This process is safe to interrupt.\r
165 > +Backing up tags to FILENAME\r
166 >  Your notmuch database has now been upgraded to database format version 2.\r
167 >  No new mail."\r
168 >  \r