]> git.cworth.org Git - notmuch/log
notmuch
20 months agodebian: upload release candidate to experimental, not unstable archive/debian/0.37_rc0-1 debian/0.37_rc0-1
David Bremner [Sun, 14 Aug 2022 10:28:40 +0000 (07:28 -0300)]
debian: upload release candidate to experimental, not unstable

Oops, tagged "upstream" version is incorrect, but it's a minor issue.

20 months agodebian: changelog stanza for 0.37~rc0-1 0.37_rc0
David Bremner [Sun, 14 Aug 2022 09:55:40 +0000 (06:55 -0300)]
debian: changelog stanza for 0.37~rc0-1

20 months agoversion: update to 0.37~rc0
David Bremner [Sun, 14 Aug 2022 09:53:41 +0000 (06:53 -0300)]
version: update to 0.37~rc0

20 months agodoc/emacs: use define-key instead of hard-coding markup
David Bremner [Sun, 31 Jul 2022 11:33:23 +0000 (08:33 -0300)]
doc/emacs: use define-key instead of hard-coding markup

Add keys to index. Allow indexing of both keys and commands. Use
standard typesetting for multiple keybindings.

20 months agodoc/emacs: replace use of emacsvar with el:defcustom
David Bremner [Sun, 31 Jul 2022 11:33:22 +0000 (08:33 -0300)]
doc/emacs: replace use of emacsvar with el:defcustom

Mainly this allows dropping the ad-hoc directive emacsvar

20 months agodoc/emacs: replace emacscmd with el:define-key
David Bremner [Sun, 31 Jul 2022 11:33:21 +0000 (08:33 -0300)]
doc/emacs: replace emacscmd with el:define-key

This allows us to eliminate the ad-hoc emacscmd directive / role, and
improve indexing.

doc/emacs: convert remaining uses of emacscmd to define-key

This allows us to remove the no-longer used object type.

20 months agodoc/emacs: split index category from label
David Bremner [Sun, 31 Jul 2022 11:33:20 +0000 (08:33 -0300)]
doc/emacs: split index category from label

A more verbose category is needed for the index, but not the
description in the manual.

20 months agodoc/emacs: drop domain label
David Bremner [Sun, 31 Jul 2022 11:33:19 +0000 (08:33 -0300)]
doc/emacs: drop domain label

This makes the generate info files somewhat less verbose, so that they
say e.g. "Key Binding" instead of "Emacs Key Binding"

20 months agodoc/elisp: replace label for Emacs commands and key bindings.
David Bremner [Sun, 31 Jul 2022 11:33:18 +0000 (08:33 -0300)]
doc/elisp: replace label for Emacs commands and key bindings.

In the notmuch doc index it is important to be clear which parts are
Emacs related.

20 months agodoc: copy elisp.py from flycheck, make available
David Bremner [Sun, 31 Jul 2022 11:33:17 +0000 (08:33 -0300)]
doc: copy elisp.py from flycheck, make available

This corresponds to flycheck commit
1702d2db3d8ba9bcb9b2bf810e791e907fcc3adc, which is apparently the last
time this file was modified (2018).

Embedding seems defensible since the file is evidently not changing
that much, and we need to change some labels to make it fit with the
not-just-emacs nature of notmuch docs.

20 months agodoc: add some documentation about duplicate files.
David Bremner [Sat, 30 Jul 2022 23:45:51 +0000 (20:45 -0300)]
doc: add some documentation about duplicate files.

This is mainly motivated by the new emacs-UI features to select
duplicates, but hopefully it will help demystify things for users of
the CLI as well.

20 months agoemacs: add docstring for notmuch-show-choose-duplicate
David Bremner [Sun, 31 Jul 2022 12:46:51 +0000 (09:46 -0300)]
emacs: add docstring for notmuch-show-choose-duplicate

It should have one in any case, but in particular it is needed for the
manual.

20 months agoemacs/show: restrict inlined mimetypes on refresh.
David Bremner [Mon, 1 Aug 2022 11:39:18 +0000 (08:39 -0300)]
emacs/show: restrict inlined mimetypes on refresh.

This fixes the bug reported by Al [1]. Essentially apply the same fix
as [2] in a different place.

[1]: id:877d41nmr1.fsf@gmail.com
[2]: 90a7c1af368a527700dcde9b0dcbd760afc7bd92

20 months agotest/emacs: add known broken test for inlining on refresh.
David Bremner [Mon, 1 Aug 2022 11:39:17 +0000 (08:39 -0300)]
test/emacs: add known broken test for inlining on refresh.

This duplicates the bug reported by Al [1]

[1]: id:877d41nmr1.fsf@gmail.com

20 months agoemacs: add duplicate support to notmuch-show-view-raw-message
David Bremner [Thu, 4 Aug 2022 11:48:08 +0000 (08:48 -0300)]
emacs: add duplicate support to notmuch-show-view-raw-message

This fixes one of the bugs reported by Gregor in [1]

[1]: id:87edxw8jp4.fsf@no.workgroup

20 months agoemacs/show: provide a more friendly function to get duplicate num
David Bremner [Thu, 4 Aug 2022 11:48:07 +0000 (08:48 -0300)]
emacs/show: provide a more friendly function to get duplicate num

There is not much code here, but at least we can fix the indexing as 1
based.

20 months agotest/emacs: add known broken test for viewing raw duplicate
David Bremner [Thu, 4 Aug 2022 11:48:06 +0000 (08:48 -0300)]
test/emacs: add known broken test for viewing raw duplicate

This duplicates one of the bugs reported by Gregor in [1].

[1]: id:87edxw8jp4.fsf@no.workgroup

20 months agoemacs: update notmuch-show-get-filename to handle duplicates
David Bremner [Thu, 4 Aug 2022 11:08:33 +0000 (08:08 -0300)]
emacs: update notmuch-show-get-filename to handle duplicates

This fixes one of the bugs reported by Gregor in [1].

[1]: id:87edxw8jp4.fsf@no.workgroup

20 months agotest/emacs: add known broken test for stashing duplicate filename
David Bremner [Thu, 4 Aug 2022 11:08:32 +0000 (08:08 -0300)]
test/emacs: add known broken test for stashing duplicate filename

This duplicates (no pun intended) one of the bugs reported by Gregor
in id:87edxw8jp4.fsf@no.workgroup

20 months agoNEWS: initial set of NEWS for 0.37.
David Bremner [Mon, 1 Aug 2022 13:14:15 +0000 (10:14 -0300)]
NEWS: initial set of NEWS for 0.37.

There are one or two more changes to apply (and potentially document)
before release, but this covers most of my commits.

20 months agodoc/notmuch: merge two sections on external commands.
David Bremner [Sat, 30 Jul 2022 23:45:49 +0000 (20:45 -0300)]
doc/notmuch: merge two sections on external commands.

When adding the description of the propagation of NOTMUCH_CONFIG, I
missed that there was already a section on external commands, with a
different title.

20 months agotests: remove dead code from T055-path-config.sh
David Bremner [Fri, 29 Jul 2022 12:19:56 +0000 (09:19 -0300)]
tests: remove dead code from T055-path-config.sh

This case statement does nothing.

20 months agonotmuch.c: add missing trailing newlines in two error messages
Tomi Ollila [Sun, 31 Jul 2022 17:32:11 +0000 (20:32 +0300)]
notmuch.c: add missing trailing newlines in two error messages

Removed duplicate error check (and the message) in 3rd case where
the same error message (w/o trailing newline) was present.

In case of test/T040-setup.sh, command substitution deletes
trailing newlines, so related test there cannot be changed
(and therefore could not notice this user experience flaw).

20 months agodoc/emacs: add docstring for notmuch-unthreaded-result-format.
David Bremner [Sat, 16 Jul 2022 21:22:28 +0000 (17:22 -0400)]
doc/emacs: add docstring for notmuch-unthreaded-result-format.

The main change is actually updating cross references.

20 months agoemacs: update defcustom for notmuch-unthreaded-result-format
David Bremner [Sat, 16 Jul 2022 21:22:27 +0000 (17:22 -0400)]
emacs: update defcustom for notmuch-unthreaded-result-format

This is essentially a copy of that for notmuch-tree-result-format,
aside from the default value.

20 months agodoc/emacs: add docstring and example for n-tree-result-format
David Bremner [Sat, 16 Jul 2022 21:22:26 +0000 (17:22 -0400)]
doc/emacs: add docstring and example for n-tree-result-format

This example is based on one originally by Jon Hurst.

20 months agoemacs: update defcustom for notmuch-search-result-format.
David Bremner [Sat, 16 Jul 2022 21:22:25 +0000 (17:22 -0400)]
emacs: update defcustom for notmuch-search-result-format.

It seems redundant to have the previous example, since the default
value is always show by describe variable.

Enforce more restrictions on the keys in the alist, since arbitrary
strings don't work as field names.

Document that functions can be used in lieu of field names.

20 months agodoc/emacs: add docstring and example for n-search-result-format
David Bremner [Sat, 16 Jul 2022 21:22:24 +0000 (17:22 -0400)]
doc/emacs: add docstring and example for n-search-result-format

When the ability to use functions was added, this example was confined
to a commit message, which is not user discoverable.

20 months agoemacs: update defcustom for notmuch-search-result-format.
David Bremner [Sat, 16 Jul 2022 21:22:23 +0000 (17:22 -0400)]
emacs: update defcustom for notmuch-search-result-format.

It seems redundant to have the previous example, since the default
value is always show by describe variable.

Enforce more restrictions on the keys in the alist, since arbitrary
strings don't work as field names.

Document that functions can be used in lieu of field names.

20 months agoemacs/reply: reply to correct duplicate
David Bremner [Fri, 1 Jul 2022 21:45:48 +0000 (18:45 -0300)]
emacs/reply: reply to correct duplicate

Essentially we just need to arrange to pass the right --duplicate
argument to notmuch reply.

As a side-effect, correct the previously unused value of EXPECTED in
T453-emacs-reply.sh.

20 months agoCLI/reply: support --duplicate argument
David Bremner [Fri, 1 Jul 2022 21:45:47 +0000 (18:45 -0300)]
CLI/reply: support --duplicate argument

We want the reply used to match that shown e.g. in the emacs
interface. As a first step provide that functionality on the command
line.

Schema does not need updating as the duplicate key was already
present (with a constant value of 1).

20 months agoemacs/show: display count of duplicates in headerline
David Bremner [Fri, 1 Jul 2022 21:45:46 +0000 (18:45 -0300)]
emacs/show: display count of duplicates in headerline

There is no real cost here, except screen real estate. Some people
might prefer hiding the duplicate count, but we leave that for a
future commit.

20 months agoemacs/show: provide notmuch-show-choose-duplicate
David Bremner [Fri, 1 Jul 2022 21:45:45 +0000 (18:45 -0300)]
emacs/show: provide notmuch-show-choose-duplicate

This new command allows the user to interactively choose a different
duplicate (file) to display for a given message in
notmuch-show-mode. Since both tree and unthreaded view use
notmuch-show-mode, this provides the same facility there.

20 months agoCLI/show: support --duplicate for structured output
David Bremner [Fri, 1 Jul 2022 21:45:44 +0000 (18:45 -0300)]
CLI/show: support --duplicate for structured output

This introduces a new mandatory key for message structures, namely
"duplicate". Per convention in devel/schemata this does _not_ increase
the format version. This means that clients are responsible for
checking that it exists, and not crashing if it does not.

The main functional change is teaching mime_node_open to understand a
'duplicate' argument.

Support for --duplicate in notmuch-reply would make sense, but we
defer it to a later commit.

20 months agoCLI/show: initial support for --duplicate for (raw output only)
David Bremner [Fri, 1 Jul 2022 21:45:43 +0000 (18:45 -0300)]
CLI/show: initial support for --duplicate for (raw output only)

Add command line argument --duplicate, analogous with that already
supported for notmuch-search.

Use of a seperate function for _get_filename is mainly a form of
documentation at this point.

md5sum is of course a weak hash, but it is good enough for
this (non-adversarial) test suite use.

21 months agoCLI/git: opportunistically use bindings to check for known messages
David Bremner [Fri, 15 Jul 2022 14:23:21 +0000 (10:23 -0400)]
CLI/git: opportunistically use bindings to check for known messages

If the bindings are installed, use them to avoid one exec of notmuch
search per message.

21 months agoCLI/git: current cache contents of index
David Bremner [Sat, 2 Jul 2022 23:45:11 +0000 (20:45 -0300)]
CLI/git: current cache contents of index

Rather than shelling out once per message to get the list of files
corresponding to tags, it is much faster (although potentially a bit
memory intensive) to read them all at once.

21 months agoperf-test: add tests notmuch-git
David Bremner [Sat, 2 Jul 2022 19:11:58 +0000 (16:11 -0300)]
perf-test: add tests notmuch-git

The main focus of these initial tests is the (currently unacceptably
slow) checkout performance.

21 months agodoc/emacs: add notmuch-show-empty-saved-searches to manual
David Bremner [Fri, 1 Jul 2022 16:14:29 +0000 (13:14 -0300)]
doc/emacs: add notmuch-show-empty-saved-searches to manual

Answering a user question, I had to dig for this variable, but I think
it is a reasonably common customization wish, particularly for users
with custom count-functions.

21 months agodoc/emacs: define and use emacsvar and emacscmd markup
David Bremner [Fri, 1 Jul 2022 10:40:39 +0000 (07:40 -0300)]
doc/emacs: define and use emacsvar and emacscmd markup

This makes it easier to navigate the merged index of all of the
notmuch documentation.

21 months agodoc: do not generate python module index
David Bremner [Fri, 1 Jul 2022 10:52:35 +0000 (07:52 -0300)]
doc: do not generate python module index

This currently seems unhelpful, and not generating it removes if from
the navigation bar, which prevents mis-clicking.

21 months agodoc: drop module index from ToC
David Bremner [Fri, 1 Jul 2022 09:52:04 +0000 (06:52 -0300)]
doc: drop module index from ToC

There is only one module listed, so the index is not useful.

21 months agodoc: retitle notmuch-emacs manual
David Bremner [Thu, 30 Jun 2022 12:27:10 +0000 (09:27 -0300)]
doc: retitle notmuch-emacs manual

This makes the HTML TOC read more naturally. Add a label to make cross
referencing easier.

21 months agodoc: reorganize sphinx toctree
David Bremner [Thu, 30 Jun 2022 12:00:43 +0000 (09:00 -0300)]
doc: reorganize sphinx toctree

This mainly affects the html output (although users generating epub or
pdf would also notice a change). The goal is twofold: make the TOC a
bit friendler and easier to navigate by introducing some hierarchy,
and allow links for nmbug and notmuch-setup.

21 months agodoc: improve config item labels in info output
David Bremner [Fri, 1 Jul 2022 11:23:24 +0000 (08:23 -0300)]
doc: improve config item labels in info output

Commit 306b7028d added the nmconfig role / directive. Unfortunately
the default of using the directive name in texinfo output is pretty
ugly, so attempt to make it more human readable by passing `objname`
to add_object_type invocation.

21 months agodoc/emacs: add discussion about notmuch-show performance.
David Bremner [Tue, 28 Jun 2022 01:02:05 +0000 (22:02 -0300)]
doc/emacs: add discussion about notmuch-show performance.

Most of the information is already in the docstrings, but hopefully
by grouping it is more discoverable.

21 months agoemacs/show: introduce notmuch-show-height-limit
David Bremner [Tue, 28 Jun 2022 01:02:04 +0000 (22:02 -0300)]
emacs/show: introduce notmuch-show-height-limit

Analogous to notmuch-show-depth-limit, it requires a bit more
calculation, but that cost seems dominated by the rendering cost.

21 months agoemacs/show: obey notmuch-show-max-text-part-size for part 0
David Bremner [Tue, 28 Jun 2022 01:02:03 +0000 (22:02 -0300)]
emacs/show: obey notmuch-show-max-text-part-size for part 0

This parameter was originally introduced to hide large attachements
that happened to be text/plain. From a performance point of view,
there is no reason not to also hide large message bodies.

21 months agoemacs/show: optionally insert bodies of "deep messages" lazily
David Bremner [Tue, 28 Jun 2022 01:02:02 +0000 (22:02 -0300)]
emacs/show: optionally insert bodies of "deep messages" lazily

This leverages the machinery already there to insert buttons for
attachments.

A potential use-case is browsing the top layers of the tree to decide
which of the lower subtrees to read.

21 months agoperf-test/emacs: test showing longish threads
David Bremner [Tue, 28 Jun 2022 01:02:01 +0000 (22:02 -0300)]
perf-test/emacs: test showing longish threads

This particular thread takes about 100 times longer to display in
emacs than on the command line.

The parameter notmuch-show-max-text-part-size exists, but is currently
ineffective for this task because it only hides attachments, not
part 0.

In future commits, the parameter notmuch-show-{depth,height}-limit
will trigger a similar kind of hiding for bodies as
n-s-m-text-part-size already does for attachments.

21 months agodebian: add git as a build-dependency, for the test suite
David Bremner [Sun, 3 Jul 2022 15:11:00 +0000 (12:11 -0300)]
debian: add git as a build-dependency, for the test suite

This is needed to run (and test) notmuch-git.

21 months agoCLI/git: add --format-version argument to init subcommand
David Bremner [Thu, 23 Jun 2022 12:30:45 +0000 (09:30 -0300)]
CLI/git: add --format-version argument to init subcommand

This is primarily intended to support testing upward compatibility
with legacy repos.

21 months agoCL/git: add format version 1
David Bremner [Thu, 23 Jun 2022 12:30:44 +0000 (09:30 -0300)]
CL/git: add format version 1

The original nmbug format (now called version 0) creates 1
subdirectory of 'tags/' per message. This causes problems for more
than (roughly) 100k messages.

Version 1 introduces 2 layers of hashed directories. This scheme was
chose to balance the number of subdirectories with the number of extra
directories (and git objects) created via hashing.

This should be upward compatible in the sense that old repositories
will continue to work with the updated notmuch-git.

21 months agoCLI/git: replace most mentions of nmbug
David Bremner [Mon, 4 Jul 2022 15:33:48 +0000 (12:33 -0300)]
CLI/git: replace most mentions of nmbug

Particularly in help messages, nmbug is confusing for users who may
have never heard of it.

21 months agotest: known broken test for top level .notmuch in split configs
David Bremner [Sun, 16 Jan 2022 15:25:10 +0000 (11:25 -0400)]
test: known broken test for top level .notmuch in split configs

In split configurations there is no special significance to a top
level directory called .notmuch in the mail root. Users should
therefore be able to have mail stored underneath it.

21 months agobindings/python-cffi: fix docstring
David Bremner [Sun, 3 Jul 2022 20:26:46 +0000 (17:26 -0300)]
bindings/python-cffi: fix docstring

the method Database.get_message does exist any more (if it ever
did). This makes the docstring unhelpful as an example.

21 months agotest: add new corpus of duplicate messages
David Bremner [Fri, 1 Jul 2022 21:45:42 +0000 (18:45 -0300)]
test: add new corpus of duplicate messages

This corpus will be used to test a new --duplicate option for notmuch-show

21 months agotest: define and use notmuch_sexp_*_sanitize functions
David Bremner [Fri, 1 Jul 2022 21:45:41 +0000 (18:45 -0300)]
test: define and use notmuch_sexp_*_sanitize functions

These are based on the equivalent functions for json. Like those,
these are pretty simple-minded, and don't really understand the
syntax.

21 months agotest: use notmuch_json_show_sanitize more places
David Bremner [Fri, 1 Jul 2022 21:45:40 +0000 (18:45 -0300)]
test: use notmuch_json_show_sanitize more places

This makes the tests more robust against changing output formats, by
allowing us to centralize fixes in the sanitization function. It is
not appropriate for all cases, in particular it is unneeded when using
test_json_nodes, and unhelpful when testing filenames.

21 months agodoc: replace symlink with copies for nmbug, notmuch-setup
David Bremner [Fri, 1 Jul 2022 01:14:20 +0000 (22:14 -0300)]
doc: replace symlink with copies for nmbug, notmuch-setup

Previously only man page aliases were being added as symlinks.  The
addition to man_pages in conf.py automatically propagates to the list
of generated info pages.

Installation of the new pages is handled by existing recipes.

21 months agoemacs: mark notmuch-query.el as obsolete
David Bremner [Tue, 28 Jun 2022 11:50:55 +0000 (08:50 -0300)]
emacs: mark notmuch-query.el as obsolete

The only functionality actually used by notmuch is the base function
notmuch-query-get-threads; the other functions in this file have
nothing to do with that (single) use.  Move that function into
notmuch-lib.el and rename to reflect use. Deprecate the other
functions in notmuch-query.el.

21 months agolib/sexp: add parameter expansion for regex and wildcard
David Bremner [Wed, 15 Jun 2022 12:14:47 +0000 (09:14 -0300)]
lib/sexp: add parameter expansion for regex and wildcard

Fix the bug reported at [1].

The parameter expansion for regex and wildcard modifiers has to be
done a bit differently, because their arguments are not s-expressions
defining complete Xapian queries.

[1]: id:87o7yxqxy6.fsf@code.pm

21 months agotest/sexp: add known broken tests for macro param inside rx/wildcard
David Bremner [Wed, 15 Jun 2022 12:14:46 +0000 (09:14 -0300)]
test/sexp: add known broken tests for macro param inside rx/wildcard

These tests replicate the problem reported by Eric Colson [1] (for the
regex case).

[1]: id:87o7yxqxy6.fsf@code.pm

21 months agomake git ignore new build products
Michael J Gruber [Wed, 29 Jun 2022 11:04:35 +0000 (13:04 +0200)]
make git ignore new build products

nmbug and notmuch-git are new build products. Make git ignore them just
like other build products.

Signed-off-by: Michael J Gruber <git@grubix.eu>
21 months agodoc/sexp: document range queries.
David Bremner [Sat, 4 Jun 2022 21:53:59 +0000 (18:53 -0300)]
doc/sexp: document range queries.

Give examples for date fields, as these are commonly useful for user
queries.

21 months agolib/sexp: allow * as alias for "" in range searches.
David Bremner [Sat, 4 Jun 2022 21:53:58 +0000 (18:53 -0300)]
lib/sexp: allow * as alias for "" in range searches.

It can be tedious to use "" inside of a string, e.g. in a shell script.

21 months agolib/sexp: special case "" as an argument in lastmod ranges.
David Bremner [Sat, 4 Jun 2022 21:53:57 +0000 (18:53 -0300)]
lib/sexp: special case "" as an argument in lastmod ranges.

Support this syntax for constincy with (data from to) ranges.

21 months agotest/sexp: one sided range searches.
David Bremner [Sat, 4 Jun 2022 21:53:56 +0000 (18:53 -0300)]
test/sexp: one sided range searches.

The date range parsing machinery already knows how to do something
appropriate with an empty string, but the lastmod parsing blindly
tries to parse each atom as a number.

21 months agolib: check for writable db in n_m_tags_maildir_flags
David Bremner [Wed, 25 May 2022 10:51:17 +0000 (07:51 -0300)]
lib: check for writable db in n_m_tags_maildir_flags

The database needs to be writable because the list of stored file
names will change in general.

21 months agolib: add NOTMUCH_STATUS_CLOSED_DATABASE, use in _n_d_ensure_writable
David Bremner [Wed, 25 May 2022 10:51:16 +0000 (07:51 -0300)]
lib: add NOTMUCH_STATUS_CLOSED_DATABASE, use in _n_d_ensure_writable

In order for a database to actually be writeable, it must be the case that it
is open, not just the correct type of Xapian object. By explicitely
checking, we are able to provide better error reporting, in particular
for the previously broken test in T566-lib-message.

21 months agolib: Add missing private status values.
David Bremner [Wed, 25 May 2022 10:51:15 +0000 (07:51 -0300)]
lib: Add missing private status values.

These were missed when the corresponding status codes were added.

21 months agolib/tag: handle NULL argument to notmuch_tags_valid
David Bremner [Wed, 25 May 2022 10:51:14 +0000 (07:51 -0300)]
lib/tag: handle NULL argument to notmuch_tags_valid

Make the behaviour when passed NULL consistent with
notmuch_filenames_valid. The library already passes the result of
notmuch_message_get_tags without checking for NULL, so it should be
handled.

21 months agotest: add known broken test for notmuch_tags_valid (NULL)
David Bremner [Wed, 25 May 2022 10:51:13 +0000 (07:51 -0300)]
test: add known broken test for notmuch_tags_valid (NULL)

This should return false, but currently segfaults.

Start a new file for tags library API related tests. This is maybe
overkill, but new C boilerplate which doesn't corrupt the database is
needed anyway.

21 months agotest: error handling for n_m_tags_to_maildir_flags
David Bremner [Wed, 25 May 2022 10:51:12 +0000 (07:51 -0300)]
test: error handling for n_m_tags_to_maildir_flags

The closed database case should fail gracefully, but currently it
segfaults.

21 months agotest: error handling in _n_message_{add,remove}_filename
David Bremner [Mon, 23 May 2022 23:39:01 +0000 (20:39 -0300)]
test: error handling in _n_message_{add,remove}_filename

Use a closed database to force throwing a Xapian exception. Leave the
check vague to accomodate a potential explicit check for open database.

21 months agolib/message: check return status from _n_m_add_{path,folder}_terms
David Bremner [Mon, 23 May 2022 23:39:00 +0000 (20:39 -0300)]
lib/message: check return status from _n_m_add_{path,folder}_terms

Mainly to propagate information about Xapian exceptions.

21 months agolib/message: check return status of _n_m_{add,remove}_term
David Bremner [Mon, 23 May 2022 23:38:59 +0000 (20:38 -0300)]
lib/message: check return status of _n_m_{add,remove}_term

Xapian exceptions are not something that can be ignored, in general.

21 months agolib: define macro NODISCARD
David Bremner [Mon, 23 May 2022 23:38:58 +0000 (20:38 -0300)]
lib: define macro NODISCARD

In either C++17 (or later) mode, or when running cppcheck, this can be
used to selectively generate warnings about discarded return values.

21 months agolib/message: drop _notmuch_message_get_thread_id_only
David Bremner [Mon, 23 May 2022 23:38:57 +0000 (20:38 -0300)]
lib/message: drop _notmuch_message_get_thread_id_only

This function has been unused since commit 4083fd8.

21 months agotest: _notmuch_message_remove_term catches exceptions.
David Bremner [Mon, 23 May 2022 23:38:56 +0000 (20:38 -0300)]
test: _notmuch_message_remove_term catches exceptions.

Unfortunately we can't differentiate between the two distinct error
conditions for Document::remove_term.

21 months agolib/message: catch exceptions in _n_m_add_term
David Bremner [Mon, 23 May 2022 23:38:55 +0000 (20:38 -0300)]
lib/message: catch exceptions in _n_m_add_term

Some code movement is needed to make sure the cache is only
invalidated when the Xapian operation succeeds.

21 months agotest: define test_private_C
David Bremner [Mon, 23 May 2022 23:38:54 +0000 (20:38 -0300)]
test: define test_private_C

When testing error handling, it is sometimes difficult to cover a
particular error path deterministically. Introduce a test function to
allow calling lower level functions directly.

21 months agoCLI: set NOTMUCH_CONFIG in hooks.
David Bremner [Sat, 4 Jun 2022 11:11:19 +0000 (08:11 -0300)]
CLI: set NOTMUCH_CONFIG in hooks.

This addresses a bug report / feature request of Uwe Kleine-König. The
assumption is that we always load a config file in the CLI (i.e. we
never pass "" as the config file argument to
notmuch_database_open_with_config).

[1]: id:8baa58c3-7ab9-ec03-1bbd-28aa5be838f2@kleine-koenig.org

21 months agotest: add known broken tests for setting NOTMUCH_CONFIG in hooks
David Bremner [Mon, 30 May 2022 11:38:19 +0000 (08:38 -0300)]
test: add known broken tests for setting NOTMUCH_CONFIG in hooks

Setting this according to --config was requested by Uwe
Kleine-König. There are some other ways that the configuration file
might be found in current notmuch, so check those as well.

As a bonus, fix a bug in the hook tests that left NOTMUCH_CONFIG set
even though a config file was provided via NOTMUCH_PROFILE.

[1]: id:8baa58c3-7ab9-ec03-1bbd-28aa5be838f2@kleine-koenig.org

22 months agodebian: install notmuch-git
David Bremner [Thu, 7 Apr 2022 22:43:15 +0000 (17:43 -0500)]
debian: install notmuch-git

Use a separate binary package to avoid dragging in dependencies on
python and git for those that do not want them.

22 months agoCLI/git: add safety checks for checkout and commit
David Bremner [Sat, 14 May 2022 18:25:47 +0000 (15:25 -0300)]
CLI/git: add safety checks for checkout and commit

Commits or checkouts that modify a large fraction of the messages in
the database should be relatively rare (and in some automated process,
probably non-existent). For initial setup, where such operations are
expected, the user can pass --force.

22 months agoCLI/git: support configuration for repo location / prefix
David Bremner [Tue, 10 May 2022 10:32:48 +0000 (07:32 -0300)]
CLI/git: support configuration for repo location / prefix

This is probably more convenient than always passing a command line
argument.

Use notmuch-config for consistency with other notmuch CLI tools.

Now that there is something relevant in the config files, test the
--config option.

22 months agoCLI/git: change defaults for repo and prefix
David Bremner [Sat, 7 May 2022 13:32:18 +0000 (10:32 -0300)]
CLI/git: change defaults for repo and prefix

The previous defaults were not suitable for personal (i.e. not
bugtracking for notmuch development) use.

Provide two ways for the user to select nmbug compatible defaults;
command line argument and checking the name of the script.

22 months agodoc/notmuch-git: initial documentation
David Bremner [Fri, 8 Apr 2022 00:41:38 +0000 (19:41 -0500)]
doc/notmuch-git: initial documentation

This is mainly derived from the various help outputs from the script,
with some massaging of markup and addition of links.

22 months agoCLI/git: cache git indices
David Bremner [Tue, 19 Apr 2022 11:32:14 +0000 (08:32 -0300)]
CLI/git: cache git indices

If the private index file matches a previously known revision of the
database, we can update the index incrementally using the recorded
lastmod counter. This is typically much faster than a full update,
although it could be slower in the case of large changes to the
database.

The "git-read-tree HEAD" is also a bottleneck, but unfortunately
sometimes is needed. Cache the index checksum and hash to reduce the
number of times the operation is run. The overall design is a
simplified version of the PrivateIndex class.

22 months agoCLI/git: add @timed decorator, time a few functions
David Bremner [Sat, 16 Apr 2022 22:44:10 +0000 (19:44 -0300)]
CLI/git: add @timed decorator, time a few functions

Perf will show which binaries are using the CPU cycles, and standard
python profilers will show which python functions, but neither is
great at finding which call to an external binary is taking time, or
locating I/O hotspots.

22 months agoCLI/git: replace enumeration of tags with sexp query.
David Bremner [Sun, 10 Apr 2022 17:22:57 +0000 (14:22 -0300)]
CLI/git: replace enumeration of tags with sexp query.

Unlike the (current) infix query parser provided by Xapian, the
notmuch specific sexp query parser supports prefixed wildcard queries,
so use those. In addition to being somewhat faster, this avoids
needing to escape all of the user's tags to pass via the shell.

22 months agotest/git: add known broken test for tag with quotes.
David Bremner [Sun, 10 Apr 2022 17:06:14 +0000 (14:06 -0300)]
test/git: add known broken test for tag with quotes.

There is current insufficient sanitization and/or escaping of tag names
internally in notmuch-git.

22 months agoCLI/git: suppress warnings about initial branch name
David Bremner [Sun, 3 Apr 2022 22:17:16 +0000 (16:17 -0600)]
CLI/git: suppress warnings about initial branch name

The canonical nmbug repository still uses "master" as the main branch
name, so defer any potential switch away from that name.

22 months agoCLI/git: rename environment variables.
David Bremner [Sun, 15 May 2022 16:47:54 +0000 (13:47 -0300)]
CLI/git: rename environment variables.

Although the code required to support both new and old environment
variables is small, it complicates the semantics of configuration, and
make the documentation harder to follow.

22 months agotest: initial tests for notmuch-git
David Bremner [Sun, 20 Mar 2022 21:33:54 +0000 (18:33 -0300)]
test: initial tests for notmuch-git

Exercise the main functionality of notmuch-git.  add_git_repos() will
hopefully be simplifed when an init subcommand is added.

22 months agoCLI/git: Add an 'init' command
W. Trevor King [Mon, 19 Jan 2015 00:40:10 +0000 (16:40 -0800)]
CLI/git: Add an 'init' command

For folks that want to start versioning a new tag-space, instead of
cloning one that someone else has already started.

The empty-blob hash-object call avoids errors like:

  $ nmbug commit
  error: invalid object 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 for
'tags/...'
  fatal: git-write-tree: error building trees
  'git HASH(0x9ef3eb8) write-tree' exited with nonzero value

David Bremner suggested [1]:

  $ git hash-object -w /dev/null

instead of my Python version of:

  $ git hash-object -w --stdin <&-

but I expect that closing stdin is more portable than the /dev/null
path (which doesn't exist on Windows, for example).

The --bare init and use of NMBGIT as the work tree (what could go
wrong with an empty commit?) are suggestions from Michal Sojka [2].

[1]: id:87y4vu6uvf.fsf@maritornes.cs.unb.ca
     http://thread.gmane.org/gmane.mail.notmuch.general/18626/focus=18720
[2]: id:87a93a5or2.fsf@resox.2x.cz
     http://thread.gmane.org/gmane.mail.notmuch.general/19495/focus=19767

22 months agoCLI/git: make existance of config branch optional on clone
David Bremner [Mon, 4 Apr 2022 03:05:36 +0000 (21:05 -0600)]
CLI/git: make existance of config branch optional on clone

This branch is actually only used by an associated
utility (notmuch-report), and notmuch-git works fine without it.

22 months agonotmuch-git: add --git-dir, --tag-prefix arguments
David Bremner [Sun, 20 Mar 2022 16:13:06 +0000 (13:13 -0300)]
notmuch-git: add --git-dir, --tag-prefix arguments

It is often more convenient to use command line arguments than
environment variables.

22 months agoCLI/git: drop support for python < 3.2
David Bremner [Sat, 7 May 2022 16:53:08 +0000 (13:53 -0300)]
CLI/git: drop support for python < 3.2

Debian stable had python 3.4.2 3 releases ago (approximately 6 years
ago), so attempting to keep track of the changes in python is probably
no longer worthwhile. We already require python 3.5 for the
python-cffi bindings (although those are not yet used in notmuch-git).