Re: WIP: promote nmbug to user sync tool

2022-04-23 Thread David Bremner
David Bremner writes: > - the (new) man page is inadequate > - notmuch git doesn't understand the common arguments to notmuch (--config > and friends) > - the defaults for prefix and git repo are wrong for most users. I was > thinking about either a > --nmbug argument to set the old defaults,

[PATCH 02/16] notmuch-git: add --git-dir argument

2022-04-23 Thread David Bremner
The intent is to change the names of the environment variables before releasing this code, so avoid relying on environment variables in the test framework. --- notmuch-git.in | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/notmuch-git.in b/notmuch-git.in ind

[PATCH 05/16] nmbug: Add an 'init' command

2022-04-23 Thread David Bremner
From: "W. Trevor King" 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/..

[PATCH 09/16] test/git: add known broken test for tag with quotes.

2022-04-23 Thread David Bremner
There is current insufficient sanitization and/or escaping of tag names internally in notmuch-git. --- test/T850-git.sh | 10 ++ 1 file changed, 10 insertions(+) diff --git a/test/T850-git.sh b/test/T850-git.sh index 417692d4..408a6337 100755 --- a/test/T850-git.sh +++ b/test/T850-git.sh

[PATCH 14/16] CLI/git: create CachedIndex class

2022-04-23 Thread David Bremner
The "git-read-tree HEAD" is 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, which is partially refactored to support the new class. --- n

[PATCH 01/16] nmbug: promote to user tool "notmuch-git"

2022-04-23 Thread David Bremner
So far this is just a rename. Documentation and tests to follow. --- Makefile.local | 7 +-- devel/nmbug/nmbug => notmuch-git.in | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) rename devel/nmbug/nmbug => notmuch-git.in (99%) diff --git a/Makefile.local b/Makefi

[PATCH 03/16] notmuch-git: add --tag-prefix argument

2022-04-23 Thread David Bremner
The test suite will require setting the tag prefix (at least initially), and this commit will enable doing that without relying on environment variables (whose names are planned to change). --- notmuch-git.in | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/notmuch

[PATCH 13/16] CLI/git: create PrivateIndex class

2022-04-23 Thread David Bremner
If the 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. --- notmuch-git.in | 220 ++

[PATCH 15/16] debian: install notmuch-git

2022-04-23 Thread David Bremner
Use a separate binary package to avoid dragging in dependencies on python and git for those that do not want them. --- debian/control | 16 debian/notmuch-git.install | 1 + 2 files changed, 17 insertions(+) create mode 100644 debian/notmuch-git.install diff --git a

[PATCH 06/16] CLI/git: suppress warnings about initial branch name

2022-04-23 Thread David Bremner
The canonical nmbug repository still uses "master" as the main branch name, so defer any potential switch away from that name. --- notmuch-git.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/notmuch-git.in b/notmuch-git.in index d574f19e..3a58fd28 100755 --- a/notmuch-git.

[PATCH 11/16] CLI/git: add @timed decorator, time a few functions

2022-04-23 Thread David Bremner
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. --- notmuch-git.in | 19 ++- 1 file changed, 18 inserti

[PATCH 04/16] test: initial tests for notmuch-git

2022-04-23 Thread David Bremner
Exercise the main functionality of notmuch-git. add_git_repos() will hopefully be simplifed when an init subcommand is added. --- test/T850-git.sh | 95 1 file changed, 95 insertions(+) create mode 100755 test/T850-git.sh diff --git a/test/T850-g

[PATCH 07/16] test: use "notmuch git init" for tests.

2022-04-23 Thread David Bremner
Stick with the test-suite specific clone script for now, until clone no longer insists on the config branch (or init creates a config branch). --- test/T850-git.sh | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/test/T850-git.sh b/test/T850-git.sh index f52dd60d..d682141

[PATCH 12/16] CLI/git: rename private index file.

2022-04-23 Thread David Bremner
All files created by notmuch-git should be in a private directory to avoid collisions. --- notmuch-git.in | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/notmuch-git.in b/notmuch-git.in index 0d9f50a1..b69d57e7 100755 --- a/notmuch-git.in +++ b/notmuch-git.in @@ -63

[PATCH 08/16] CLI/git: make existance of config branch optional on clone

2022-04-23 Thread David Bremner
This branch is actually only used by an associated utility (notmuch-report), and notmuch-git works fine without it. With this change we can use "notmuch git clone" in the setup for the tests in T850-git.sh --- notmuch-git.in | 8 +++- test/T850-git.sh | 9 + 2 files changed, 8 inser

[PATCH 10/16] CLI/git: replace enumeration of tags with sexp query.

2022-04-23 Thread David Bremner
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. --- notmuch-git.in | 23 +

[PATCH 16/16] WIP: start manual page for notmuch-git

2022-04-23 Thread David Bremner
--- doc/conf.py | 4 ++ doc/index.rst| 1 + doc/man1/notmuch-git.rst | 106 +++ 3 files changed, 111 insertions(+) create mode 100644 doc/man1/notmuch-git.rst diff --git a/doc/conf.py b/doc/conf.py index e46e1d4e..da0635bb 100644 -

WIP: promote nmbug to user sync tool

2022-04-23 Thread David Bremner
One of the things that new (and old) users of notmuch often miss is a way to sync tags between hosts. muchsync exists, but it's a third party tool, and (if I understand correctly) it directly modifies the notmuch database. Meanwhile we ship a moderately complex python script called 'nmbug' which ca