Re: [PATCH v4 16/16] add "notmuch reindex" subcommand
[notmuch-archives.git] / a9 / 8eef01c97ed453f47ab5f5a3cfdeba6262ef1e
1 Return-Path: <patricktotzke@googlemail.com>\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 1D555431FD0\r
6         for <notmuch@notmuchmail.org>; Fri, 15 Jul 2011 14:05:08 -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.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id ruqfLiZG8Lm4 for <notmuch@notmuchmail.org>;\r
17         Fri, 15 Jul 2011 14:05:06 -0700 (PDT)\r
18 Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com\r
19         [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 70FCE431FB6\r
22         for <notmuch@notmuchmail.org>; Fri, 15 Jul 2011 14:05:06 -0700 (PDT)\r
23 Received: by wyh22 with SMTP id 22so157315wyh.26\r
24         for <notmuch@notmuchmail.org>; Fri, 15 Jul 2011 14:05:05 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
26         d=googlemail.com; s=gamma;\r
27         h=date:from:to:cc:subject:message-id:references:mime-version\r
28         :content-type:content-disposition:in-reply-to:user-agent;\r
29         bh=V3zQRKMzswT0p+Ea5SeFDOsVATl5ziCMX2QVRUMryk4=;\r
30         b=agiWonabGt/EMh1mOCyXJEr1ofmgKLL0dPjiK2bOmAzdBEEJ8Bb8Z1rFqZVPDDYaY3\r
31         A5KY2n140R8IYLY6VPJFYJ9zG0W3laP8cV6+CLrtcf2tsDDmXx9IcYFikKaw+peEJPOc\r
32         yujFkHKejxzf8UsMbCBed//27LV6fgV4Y9QJg=\r
33 Received: by 10.227.62.194 with SMTP id y2mr1407413wbh.43.1310763905043;\r
34         Fri, 15 Jul 2011 14:05:05 -0700 (PDT)\r
35 Received: from brick.lan (cpc1-sgyl2-0-0-cust47.sgyl.cable.virginmedia.com\r
36         [80.192.18.48])\r
37         by mx.google.com with ESMTPS id ff6sm1355826wbb.32.2011.07.15.14.05.02\r
38         (version=TLSv1/SSLv3 cipher=OTHER);\r
39         Fri, 15 Jul 2011 14:05:03 -0700 (PDT)\r
40 Date: Fri, 15 Jul 2011 22:04:59 +0100\r
41 From: Patrick Totzke <patricktotzke@googlemail.com>\r
42 To: Jameson Graef Rollins <jrollins@finestructure.net>\r
43 Subject: Re: date_relative in notmuch-search\r
44 Message-ID: <20110715210459.GA12727@brick.lan>\r
45 References: <20110714222258.GA11914@brick.lan>\r
46         <87oc0v4jt6.fsf@servo.factory.finestructure.net>\r
47 MIME-Version: 1.0\r
48 Content-Type: multipart/signed; micalg=pgp-sha1;\r
49         protocol="application/pgp-signature"; boundary="1LKvkjL3sHcu1TtY"\r
50 Content-Disposition: inline\r
51 In-Reply-To: <87oc0v4jt6.fsf@servo.factory.finestructure.net>\r
52 User-Agent: Mutt/1.5.21 (2010-09-15)\r
53 Cc: Patrick Totzke <patricktotzke@googlemail.com>, notmuch@notmuchmail.org\r
54 X-BeenThere: notmuch@notmuchmail.org\r
55 X-Mailman-Version: 2.1.13\r
56 Precedence: list\r
57 List-Id: "Use and development of the notmuch mail system."\r
58         <notmuch.notmuchmail.org>\r
59 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
60         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
61 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
62 List-Post: <mailto:notmuch@notmuchmail.org>\r
63 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
64 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
66 X-List-Received-Date: Fri, 15 Jul 2011 21:05:08 -0000\r
67 \r
68 \r
69 --1LKvkjL3sHcu1TtY\r
70 Content-Type: multipart/mixed; boundary="gKMricLos+KVdGMg"\r
71 Content-Disposition: inline\r
72 \r
73 \r
74 --gKMricLos+KVdGMg\r
75 Content-Type: text/plain; charset=us-ascii\r
76 Content-Disposition: inline\r
77 Content-Transfer-Encoding: quoted-printable\r
78 \r
79 Hi Jason,\r
80 \r
81 Thanks for the tip with git send-mail. I didn't really intend to\r
82 get this "patch" accepted. It was more that I feel bad asking for=20\r
83 features all the time and as I'm not so comfortable with hacking\r
84 on the notmuch code I thought I'd ask if one could implement it like this.\r
85 Anyhow, attached you'll find a patch for the test and another for\r
86 the proposed change. Feel free to discard it :)\r
87 Best,\r
88 /p\r
89 \r
90 On Fri, Jul 15, 2011 at 08:58:45AM -0700, Jameson Graef Rollins wrote:\r
91 > On Thu, 14 Jul 2011 23:22:58 +0100, Patrick Totzke <patricktotzke@googlem=\r
92 ail.com> wrote:\r
93 > > I wodered why "notmuch search --format=3Djson" doesn't provide the "dat=\r
94 e_relative" field for\r
95 > > results, as the show command does.\r
96 > >=20\r
97 > > I'm not expert on notmuch internals but I got it working like this:\r
98 >=20\r
99 > Hi, Patrick.  I think this is a very reasonable patch.  However, there\r
100 > are a couple of things you need to do to get this patch accepted.\r
101 >=20\r
102 > First of all, you should send the patch to the list in a format that\r
103 > will allow it to be applied directly to a git repo.  In particular, it\r
104 > needs to include a good commit log message.  Look at using git send-mail\r
105 > to send it to the list, which will format it correctly.\r
106 >=20\r
107 > Also, I'm quite sure this patch will require a couple of changes to the\r
108 > test suite.  You should submit a patch that changes the test suite to\r
109 > reflect the desired changes *first*, followed by the patch that fixes\r
110 > the issue.\r
111 >=20\r
112 > Thanks!\r
113 >=20\r
114 > jamie.\r
115 \r
116 \r
117 \r
118 --gKMricLos+KVdGMg\r
119 Content-Type: text/x-diff; charset=iso-8859-1\r
120 Content-Disposition: attachment; filename="0001-test-date_relative-in-notmuch-search-json-output.patch"\r
121 Content-Transfer-Encoding: quoted-printable\r
122 \r
123 =46rom 9a0260e36e36af94bed695e713bbc1be0a069fce Mon Sep 17 00:00:00 2001\r
124 =46rom: pazz <patricktotzke@gmail.com>\r
125 Date: Fri, 15 Jul 2011 21:36:54 +0100\r
126 Subject: [PATCH 1/2] test: date_relative in notmuch search json output\r
127 \r
128 expect the date_relative field for thread entries\r
129 in notmuch search's json output\r
130 ---\r
131  test/json |    2 ++\r
132  1 files changed, 2 insertions(+), 0 deletions(-)\r
133 \r
134 diff --git a/test/json b/test/json\r
135 index 5a2544c..d54bf25 100755\r
136 --- a/test/json\r
137 +++ b/test/json\r
138 @@ -12,6 +12,7 @@ add_message "[subject]=3D\"json-search-subject\"" "[date]=\r
139 =3D\"Sat, 01 Jan 2000 12:00\r
140  output=3D$(notmuch search --format=3Djson "json-search-message" | notmuch_=\r
141 search_sanitize)\r
142  test_expect_equal "$output" "[{\"thread\": \"XXX\",\r
143  \"timestamp\": 946728000,\r
144 +\"date_relative\": \"2000-01-01\",\r
145  \"matched\": 1,\r
146  \"total\": 1,\r
147  \"authors\": \"Notmuch Test Suite\",\r
148 @@ -28,6 +29,7 @@ add_message "[subject]=3D\"json-search-utf8-body-s=FCbj=\r
149 =E9ct\"" "[date]=3D\"Sat, 01 Ja\r
150  output=3D$(notmuch search --format=3Djson "js=F6n-search-m=E9ssage" | notm=\r
151 uch_search_sanitize)\r
152  test_expect_equal "$output" "[{\"thread\": \"XXX\",\r
153  \"timestamp\": 946728000,\r
154 +\"date_relative\": \"2000-01-01\",\r
155  \"matched\": 1,\r
156  \"total\": 1,\r
157  \"authors\": \"Notmuch Test Suite\",\r
158 --=20\r
159 1.7.4.1\r
160 \r
161 \r
162 --gKMricLos+KVdGMg\r
163 Content-Type: text/x-diff; charset=us-ascii\r
164 Content-Disposition: attachment; filename="0002-json-date_relative-for-threads.patch"\r
165 Content-Transfer-Encoding: quoted-printable\r
166 \r
167 =46rom 1a796b09eb4c6171ddaf5f847df56d1a0181cb7c Mon Sep 17 00:00:00 2001\r
168 =46rom: pazz <patricktotzke@gmail.com>\r
169 Date: Fri, 15 Jul 2011 21:41:02 +0100\r
170 Subject: [PATCH 2/2] json: date_relative for threads\r
171 \r
172 include the date_relative field in the\r
173 json formated output of notmuch search\r
174 ---\r
175  notmuch-search.c |    2 ++\r
176  1 files changed, 2 insertions(+), 0 deletions(-)\r
177 \r
178 diff --git a/notmuch-search.c b/notmuch-search.c\r
179 index faccaf7..b1adc03 100644\r
180 --- a/notmuch-search.c\r
181 +++ b/notmuch-search.c\r
182 @@ -176,12 +176,14 @@ format_thread_json (const void *ctx,\r
183 =20\r
184      printf ("\"thread\": %s,\n"\r
185             "\"timestamp\": %ld,\n"\r
186 +           "\"date_relative\": \"%s\",\n"\r
187             "\"matched\": %d,\n"\r
188             "\"total\": %d,\n"\r
189             "\"authors\": %s,\n"\r
190             "\"subject\": %s,\n",\r
191             json_quote_str (ctx_quote, thread_id),\r
192             date,\r
193 +           notmuch_time_relative_date (ctx, date),\r
194             matched,\r
195             total,\r
196             json_quote_str (ctx_quote, authors),\r
197 --=20\r
198 1.7.4.1\r
199 \r
200 \r
201 --gKMricLos+KVdGMg--\r
202 \r
203 --1LKvkjL3sHcu1TtY\r
204 Content-Type: application/pgp-signature; name="signature.asc"\r
205 Content-Description: Digital signature\r
206 \r
207 -----BEGIN PGP SIGNATURE-----\r
208 Version: GnuPG v1.4.11 (GNU/Linux)\r
209 \r
210 iEYEARECAAYFAk4gq3sACgkQlDQDZ9fWxapKwQCffylNXfjJ5/wP3TxSBl9o6jrn\r
211 VzQAnA7dgbMDYk5wf0MQPb+dM+XPDw3s\r
212 =htto\r
213 -----END PGP SIGNATURE-----\r
214 \r
215 --1LKvkjL3sHcu1TtY--\r