[PATCH 2/2] emacs: address: allow internal completion on an individual basis
[notmuch-archives.git] / e1 / d760a082d2a4c29c4414dfecfd56ea00c47946
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 DECA2431FD6\r
6         for <notmuch@notmuchmail.org>; Sat, 26 Jul 2014 20:53:46 -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: -2.3\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_MED=-2.3] 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 pkaRQ0FBN+I8 for <notmuch@notmuchmail.org>;\r
16         Sat, 26 Jul 2014 20:53:41 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-8.mit.edu (dmz-mailsec-scanner-8.mit.edu\r
18         [18.7.68.37])\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 BC41D431FD5\r
22         for <notmuch@notmuchmail.org>; Sat, 26 Jul 2014 20:53:13 -0700 (PDT)\r
23 X-AuditID: 12074425-f79766d000006da8-d6-53d477a97527\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-8.mit.edu (Symantec Messaging Gateway) with SMTP\r
28         id B1.5E.28072.9A774D35; Sat, 26 Jul 2014 23:53:13 -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 s6R3r2eK004149; \r
31         Sat, 26 Jul 2014 23:53:02 -0400\r
32 Received: from drake.dyndns.org\r
33         (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
34         [216.15.114.40]) (authenticated bits=0)\r
35         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
36         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s6R3r0fF016406\r
37         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
38         Sat, 26 Jul 2014 23:53:01 -0400\r
39 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
40         (envelope-from <amdragon@mit.edu>)\r
41         id 1XBFW8-00051W-E8; Sat, 26 Jul 2014 23:53:00 -0400\r
42 From: Austin Clements <amdragon@MIT.EDU>\r
43 To: notmuch@notmuchmail.org\r
44 Subject: [PATCH 10/14] lib: Reorganize upgrade around document types\r
45 Date: Sat, 26 Jul 2014 23:52:49 -0400\r
46 Message-Id: <1406433173-19169-11-git-send-email-amdragon@mit.edu>\r
47 X-Mailer: git-send-email 2.0.0\r
48 In-Reply-To: <1406433173-19169-1-git-send-email-amdragon@mit.edu>\r
49 References: <1406433173-19169-1-git-send-email-amdragon@mit.edu>\r
50 X-Brightmail-Tracker:\r
51  H4sIAAAAAAAAA+NgFtrIIsWRmVeSWpSXmKPExsUixCmqrbuy/Eqwwd9pyhbXb85kdmD0eLbq\r
52         FnMAYxSXTUpqTmZZapG+XQJXRvOS1ewFaxUrTnXMYW9gXCPVxcjJISFgIrH5ZisjhC0mceHe\r
53         erYuRi4OIYHZTBLrfxxnB0kICWxklNh1JhEicYdJYsGpU0wQzlxGiTv/ullAqtgENCS27V8O\r
54         NkpEQFpi593ZrF2MHBzMAmoSf7pUQMLCAi4Sh3sfg5WwCKhKnHn5nBXE5hVwlJi9ais7xBVy\r
55         Eg03PrGB2JxA8ePPTrCBjBEScJC4dSlxAiP/AkaGVYyyKblVurmJmTnFqcm6xcmJeXmpRboW\r
56         ermZJXqpKaWbGEEhw+6iuoNxwiGlQ4wCHIxKPLwCLFeChVgTy4orcw8xSnIwKYny7jcDCvEl\r
57         5adUZiQWZ8QXleakFh9ilOBgVhLhFSoGyvGmJFZWpRblw6SkOViUxHnfWlsFCwmkJ5akZqem\r
58         FqQWwWRlODiUJHjDyoAaBYtS01Mr0jJzShDSTBycIMN5gIZvKAUZXlyQmFucmQ6RP8WoKCXO\r
59         GwuMSiEBkERGaR5cLyymXzGKA70izMsKsoIHmA7gul8BDWYCGszifxlkcEkiQkqqgTHs052Z\r
60         BVw9u59FPvwje/zmwuKI5QGlW1/URS33P/qs+tte//0+tk5H43YdLzy5QXH3M+YnkU0vb6+L\r
61         jrjY2zXlxf44mffiPx7EaYUubbnod71i0tuW/zWnnx6f1L7DfAbDj8Ir0VPVJ5/fX573jtM6\r
62         4r4xp0TqU4md2w/mLdn9pURuqtY5y0kLlViKMxINtZiLihMBz2hOVsQCAAA=\r
63 X-BeenThere: notmuch@notmuchmail.org\r
64 X-Mailman-Version: 2.1.13\r
65 Precedence: list\r
66 List-Id: "Use and development of the notmuch mail system."\r
67         <notmuch.notmuchmail.org>\r
68 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
69         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
70 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
71 List-Post: <mailto:notmuch@notmuchmail.org>\r
72 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
73 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
74         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
75 X-List-Received-Date: Sun, 27 Jul 2014 03:53:47 -0000\r
76 \r
77 Rather than potentially making multiple passes over the same type of\r
78 data in the database, reorganize upgrade around each type of data that\r
79 may be upgraded.  This eliminates code duplication, will make\r
80 multi-version upgrades faster, and will let us improve progress\r
81 reporting.\r
82 ---\r
83  lib/database.cc | 71 +++++++++++++++++++++------------------------------------\r
84  1 file changed, 26 insertions(+), 45 deletions(-)\r
85 \r
86 diff --git a/lib/database.cc b/lib/database.cc\r
87 index 1dd2cd9..155cbac 100644\r
88 --- a/lib/database.cc\r
89 +++ b/lib/database.cc\r
90 @@ -1243,11 +1243,9 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,\r
91      /* Perform the upgrade in a transaction. */\r
92      db->begin_transaction (true);\r
93  \r
94 -    /* Before version 1, each message document had its filename in the\r
95 -     * data field. Copy that into the new format by calling\r
96 -     * notmuch_message_add_filename.\r
97 -     */\r
98 -    if (new_features & NOTMUCH_FEATURE_FILE_TERMS) {\r
99 +    /* Perform per-message upgrades. */\r
100 +    if (new_features &\r
101 +       (NOTMUCH_FEATURE_FILE_TERMS | NOTMUCH_FEATURE_BOOL_FOLDER)) {\r
102         notmuch_query_t *query = notmuch_query_create (notmuch, "");\r
103         notmuch_messages_t *messages;\r
104         notmuch_message_t *message;\r
105 @@ -1266,13 +1264,28 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,\r
106  \r
107             message = notmuch_messages_get (messages);\r
108  \r
109 -           filename = _notmuch_message_talloc_copy_data (message);\r
110 -           if (filename && *filename != '\0') {\r
111 -               _notmuch_message_add_filename (message, filename);\r
112 -               _notmuch_message_clear_data (message);\r
113 +           /* Before version 1, each message document had its\r
114 +            * filename in the data field. Copy that into the new\r
115 +            * format by calling notmuch_message_add_filename.\r
116 +            */\r
117 +           if (new_features & NOTMUCH_FEATURE_FILE_TERMS) {\r
118 +               filename = _notmuch_message_talloc_copy_data (message);\r
119 +               if (filename && *filename != '\0') {\r
120 +                   _notmuch_message_add_filename (message, filename);\r
121 +                   _notmuch_message_clear_data (message);\r
122 +                   _notmuch_message_sync (message);\r
123 +               }\r
124 +               talloc_free (filename);\r
125 +           }\r
126 +\r
127 +           /* Prior to version 2, the "folder:" prefix was\r
128 +            * probabilistic and stemmed. Change it to the current\r
129 +            * boolean prefix. Add "path:" prefixes while at it.\r
130 +            */\r
131 +           if (new_features & NOTMUCH_FEATURE_BOOL_FOLDER) {\r
132 +               _notmuch_message_upgrade_folder (message);\r
133                 _notmuch_message_sync (message);\r
134             }\r
135 -           talloc_free (filename);\r
136  \r
137             notmuch_message_destroy (message);\r
138  \r
139 @@ -1282,7 +1295,9 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,\r
140         notmuch_query_destroy (query);\r
141      }\r
142  \r
143 -    /* Also, before version 1 we stored directory timestamps in\r
144 +    /* Perform per-directory upgrades. */\r
145 +\r
146 +    /* Before version 1 we stored directory timestamps in\r
147       * XTIMESTAMP documents instead of the current XDIRECTORY\r
148       * documents. So copy those as well. */\r
149      if (new_features & NOTMUCH_FEATURE_DIRECTORY_DOCS) {\r
150 @@ -1324,40 +1339,6 @@ notmuch_database_upgrade (notmuch_database_t *notmuch,\r
151         }\r
152      }\r
153  \r
154 -    /*\r
155 -     * Prior to version 2, the "folder:" prefix was probabilistic and\r
156 -     * stemmed. Change it to the current boolean prefix. Add "path:"\r
157 -     * prefixes while at it.\r
158 -     */\r
159 -    if (new_features & NOTMUCH_FEATURE_BOOL_FOLDER) {\r
160 -       notmuch_query_t *query = notmuch_query_create (notmuch, "");\r
161 -       notmuch_messages_t *messages;\r
162 -       notmuch_message_t *message;\r
163 -\r
164 -       count = 0;\r
165 -       total = notmuch_query_count_messages (query);\r
166 -\r
167 -       for (messages = notmuch_query_search_messages (query);\r
168 -            notmuch_messages_valid (messages);\r
169 -            notmuch_messages_move_to_next (messages)) {\r
170 -           if (do_progress_notify) {\r
171 -               progress_notify (closure, (double) count / total);\r
172 -               do_progress_notify = 0;\r
173 -           }\r
174 -\r
175 -           message = notmuch_messages_get (messages);\r
176 -\r
177 -           _notmuch_message_upgrade_folder (message);\r
178 -           _notmuch_message_sync (message);\r
179 -\r
180 -           notmuch_message_destroy (message);\r
181 -\r
182 -           count++;\r
183 -       }\r
184 -\r
185 -       notmuch_query_destroy (query);\r
186 -    }\r
187 -\r
188      notmuch->features = target_features;\r
189      db->set_metadata ("features", _print_features (local, notmuch->features));\r
190      db->set_metadata ("version", STRINGIFY (NOTMUCH_DATABASE_VERSION));\r
191 -- \r
192 2.0.0\r
193 \r