Hi Jason, Thanks for the tip with git send-mail. I didn't really intend to get this "patch" accepted. It was more that I feel bad asking for features all the time and as I'm not so comfortable with hacking on the notmuch code I thought I'd ask if one could implement it like this. Anyhow, attached you'll find a patch for the test and another for the proposed change. Feel free to discard it :) Best, /p
On Fri, Jul 15, 2011 at 08:58:45AM -0700, Jameson Graef Rollins wrote: > On Thu, 14 Jul 2011 23:22:58 +0100, Patrick Totzke > <patricktot...@googlemail.com> wrote: > > I wodered why "notmuch search --format=json" doesn't provide the > > "date_relative" field for > > results, as the show command does. > > > > I'm not expert on notmuch internals but I got it working like this: > > Hi, Patrick. I think this is a very reasonable patch. However, there > are a couple of things you need to do to get this patch accepted. > > First of all, you should send the patch to the list in a format that > will allow it to be applied directly to a git repo. In particular, it > needs to include a good commit log message. Look at using git send-mail > to send it to the list, which will format it correctly. > > Also, I'm quite sure this patch will require a couple of changes to the > test suite. You should submit a patch that changes the test suite to > reflect the desired changes *first*, followed by the patch that fixes > the issue. > > Thanks! > > jamie.
From 9a0260e36e36af94bed695e713bbc1be0a069fce Mon Sep 17 00:00:00 2001 From: pazz <patricktot...@gmail.com> Date: Fri, 15 Jul 2011 21:36:54 +0100 Subject: [PATCH 1/2] test: date_relative in notmuch search json output expect the date_relative field for thread entries in notmuch search's json output --- test/json | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/test/json b/test/json index 5a2544c..d54bf25 100755 --- a/test/json +++ b/test/json @@ -12,6 +12,7 @@ add_message "[subject]=\"json-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00 output=$(notmuch search --format=json "json-search-message" | notmuch_search_sanitize) test_expect_equal "$output" "[{\"thread\": \"XXX\", \"timestamp\": 946728000, +\"date_relative\": \"2000-01-01\", \"matched\": 1, \"total\": 1, \"authors\": \"Notmuch Test Suite\", @@ -28,6 +29,7 @@ add_message "[subject]=\"json-search-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Ja output=$(notmuch search --format=json "jsön-search-méssage" | notmuch_search_sanitize) test_expect_equal "$output" "[{\"thread\": \"XXX\", \"timestamp\": 946728000, +\"date_relative\": \"2000-01-01\", \"matched\": 1, \"total\": 1, \"authors\": \"Notmuch Test Suite\", -- 1.7.4.1
From 1a796b09eb4c6171ddaf5f847df56d1a0181cb7c Mon Sep 17 00:00:00 2001 From: pazz <patricktot...@gmail.com> Date: Fri, 15 Jul 2011 21:41:02 +0100 Subject: [PATCH 2/2] json: date_relative for threads include the date_relative field in the json formated output of notmuch search --- notmuch-search.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/notmuch-search.c b/notmuch-search.c index faccaf7..b1adc03 100644 --- a/notmuch-search.c +++ b/notmuch-search.c @@ -176,12 +176,14 @@ format_thread_json (const void *ctx, printf ("\"thread\": %s,\n" "\"timestamp\": %ld,\n" + "\"date_relative\": \"%s\",\n" "\"matched\": %d,\n" "\"total\": %d,\n" "\"authors\": %s,\n" "\"subject\": %s,\n", json_quote_str (ctx_quote, thread_id), date, + notmuch_time_relative_date (ctx, date), matched, total, json_quote_str (ctx_quote, authors), -- 1.7.4.1
signature.asc
Description: Digital signature
_______________________________________________ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch