This introduces a dependency on the (new) python bindings, but since it also yields a 4x performance improvement on the large performance corpus, I think it is worth it. --- debian/control | 1 + notmuch-git.py | 18 +++++++++--------- test/T850-git.sh | 2 ++ 3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/debian/control b/debian/control index 0ffe958c..7099fe97 100644 --- a/debian/control +++ b/debian/control @@ -73,6 +73,7 @@ Depends: git, notmuch, python3, + python3-notmuch2 ${misc:Depends} Description: thread-based email index, search and tagging Notmuch is a system for indexing, searching, reading, and tagging diff --git a/notmuch-git.py b/notmuch-git.py index a3ae15f7..eac24a46 100644 --- a/notmuch-git.py +++ b/notmuch-git.py @@ -701,21 +701,21 @@ def _is_unmerged(ref='@{upstream}'): @timed def get_status(): + from notmuch2 import Database + status = { 'deleted': {}, 'missing': {}, } with PrivateIndex(repo=NOTMUCH_GIT_DIR, prefix=TAG_PREFIX) as index: maybe_deleted = index.diff(filter='D') - for id, tags in maybe_deleted.items(): - (_, stdout, stderr) = _spawn( - args=['notmuch', 'search', '--output=files', 'id:{0}'.format(id)], - stdout=_subprocess.PIPE, - wait=True) - if stdout: - status['deleted'][id] = tags - else: - status['missing'][id] = tags + with Database() as notmuch: + for id, tags in maybe_deleted.items(): + try: + _ = notmuch.find(id) + status['deleted'][id] = tags + except LookupError: + status['missing'][id] = tags status['added'] = index.diff(filter='A') return status diff --git a/test/T850-git.sh b/test/T850-git.sh index 81400328..b1bc9e7e 100755 --- a/test/T850-git.sh +++ b/test/T850-git.sh @@ -7,6 +7,8 @@ if [ $NOTMUCH_HAVE_SFSEXP -ne 1 ]; then test_done fi +export PYTHONPATH="$NOTMUCH_BUILDDIR/bindings/python-cffi/build/stage:${PYTHONPATH:+:$PYTHONPATH}" + # be very careful using backup_database / restore_database in this # file, as they fool the cache invalidation checks in notmuch-git. -- 2.35.2 _______________________________________________ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-le...@notmuchmail.org