]> git.notmuchmail.org Git - notmuch/log
notmuch
9 years agocli: Introduce "notmuch address" command
Michal Sojka [Wed, 5 Nov 2014 00:25:55 +0000 (01:25 +0100)]
cli: Introduce "notmuch address" command

This moves address-related functionality from search command to the
new address command. The implementation shares almost all code and
some command line options.

Options --offset and --limit were intentionally not included in the
address command, because they refer to messages numbers, which users
do not see in the output. This could confuse users because, for
example, they could see more addresses in the output that what was
specified with --limit. This functionality can be correctly
reimplemented for address subcommand later.

Also useless values of --exclude flag were not included in the address
command.

This was inspired by a patch from Jani Nikula.

9 years agocli: add support for hierarchical command line option arrays
Jani Nikula [Wed, 5 Nov 2014 00:25:54 +0000 (01:25 +0100)]
cli: add support for hierarchical command line option arrays

NOTMUCH_OPT_INHERIT expects a notmuch_opt_desc_t * pointer in
output_var.

The "Unrecognized option" message was moved out of parse_option() to
not be emitted twice or when parsing a non-inherited option.

9 years agocli: search: Split notmuch_search_command to smaller functions
Michal Sojka [Wed, 5 Nov 2014 00:25:53 +0000 (01:25 +0100)]
cli: search: Split notmuch_search_command to smaller functions

In a subsequent commit, these functions will be used to share some
functionality between search and address commands.

9 years agocli: search: Convert ctx. to ctx->
Michal Sojka [Wed, 5 Nov 2014 00:25:52 +0000 (01:25 +0100)]
cli: search: Convert ctx. to ctx->

In the next commit, notmuch_search_command will be refactored to
several smaller functions. In order to simplify the next commit to
verbatim move of several lines to new functions with search_context_t*
argument, we convert all references to this structure to pointer
dereferences. To do so we rename the context variable and use the
original name ctx as the pointer to the renamed structure.

9 years agocli: search: Move more variables into search_context_t
Michal Sojka [Wed, 5 Nov 2014 00:25:51 +0000 (01:25 +0100)]
cli: search: Move more variables into search_context_t

In order to share some command line options between search and address
subcommands we need to add corresponding variables to the context
structure. While we are at it, we also add notmuch_database_t to unify
parameters of all do_search_* functions and to simplify subsequent
commits.

Otherwise, there are no functional changes.

9 years agocli: search: Rename options to context
Michal Sojka [Wed, 5 Nov 2014 00:25:50 +0000 (01:25 +0100)]
cli: search: Rename options to context

In the next commit the options structure will be extended by
non-option variables. Therefore we need a more generic name.

Just text replacement, no other changes.

9 years agodevel: man-to-mdwn.pl: add GPLv3+ notice to manpages.mdwn
Tomi Ollila [Sat, 1 Nov 2014 10:47:12 +0000 (12:47 +0200)]
devel: man-to-mdwn.pl: add GPLv3+ notice to manpages.mdwn

Make the generated head manual page (in the notmuchmail wiki)
display the licence information the whole notmuch software is licenced
under.

9 years agodevel: make man-to-mdwn.pl to work with generated manual pages
Tomi Ollila [Mon, 4 Aug 2014 17:39:32 +0000 (20:39 +0300)]
devel: make man-to-mdwn.pl to work with generated manual pages

The new manual pages converted from rst using sphinx or rst2man
has somewhat different syntax. man-to-mdwn.pl is now adjusted
to produce even better output from this syntax. The changes also
include using utf-8 locale (e.g. for tables and generated hypens)
and and quite a few bugs fixes.
This tool still produces better results than just using the
html pages generated using sphinx / rst2html. For example those
tools don't create inter-page hyperlinks -- and the preformatted
pages written by man-to-mdwn.pl just works well with manual page
content.

9 years agotest: Make gen-threads work with python3
Jesse Rosenthal [Fri, 31 Oct 2014 17:33:25 +0000 (13:33 -0400)]
test: Make gen-threads work with python3

python3 doesn't allow dictionaries to be initialized with non-string
keywords. This presents problems on systems in which "python" means
"python3". We instead initalize the dictionary using the dict
comprehension and then update it with the values from the tree. This
will work with both python2 and python3.

9 years agotest: add tests for --output=messages --duplicate=N
Jani Nikula [Sat, 1 Nov 2014 09:31:07 +0000 (11:31 +0200)]
test: add tests for --output=messages --duplicate=N

Basic smoke tests for the feature, nothing fancy.

9 years agocli: add support for notmuch search --duplicate=N with --output=messages
Jani Nikula [Sat, 1 Nov 2014 09:31:06 +0000 (11:31 +0200)]
cli: add support for notmuch search --duplicate=N with --output=messages

Print the message IDs of all messages matching the search terms that
have at least N files associated with them.

9 years agoconfigure: move make {,install} instructions to the end
Tomi Ollila [Sat, 1 Nov 2014 09:39:04 +0000 (11:39 +0200)]
configure: move make {,install} instructions to the end

There was theorical possibility that writing the config files could
have skipped (by interruption) after the instructions how to make
notmuch was printed out.

9 years agocli: search: Add --output={sender,recipients}
Michal Sojka [Fri, 31 Oct 2014 21:53:58 +0000 (22:53 +0100)]
cli: search: Add --output={sender,recipients}

The new outputs allow printing senders, recipients or both of matching
messages. To print both, the user can use --output=sender and
--output=recipients simultaneously.

Currently, the same address can appear multiple times in the output.
The next commit will change this. For this reason, tests are
introduced there.

We use mailbox_t rather than InternetAddressMailbox because we will
need to extend it in a following commit.

This code is based on a patch from Jani Nikula.

9 years agocli: search: Convert --output to keyword-flag argument
Michal Sojka [Fri, 31 Oct 2014 21:53:57 +0000 (22:53 +0100)]
cli: search: Convert --output to keyword-flag argument

This converts "notmuch search" to use the recently introduced
keyword-flag argument parser. At this point, it only makes the code
slightly less readable but following commits that add new --output
keywords will profit from this.

9 years agocli: Add support for parsing keyword-flag arguments
Jani Nikula [Fri, 31 Oct 2014 21:53:56 +0000 (22:53 +0100)]
cli: Add support for parsing keyword-flag arguments

This allows having multiple --foo=bar --foo=baz options on the command
line, with the corresponding values OR'd together.

[Test added by Michal Sojka]

9 years agocli: search: Refactor passing of command line options
Michal Sojka [Fri, 31 Oct 2014 21:53:55 +0000 (22:53 +0100)]
cli: search: Refactor passing of command line options

Many functions that implement the search command need to access command
line options. Instead of passing each option in a separate variable, put
them in a structure and pass only this structure.

This will become handy in the following commits.

9 years agoNEWS: Improved `q` binding.
David Edmondson [Fri, 31 Oct 2014 17:24:47 +0000 (17:24 +0000)]
NEWS: Improved `q` binding.

9 years agoemacs: Improve the behaviour of the 'q' binding.
David Edmondson [Wed, 29 Oct 2014 14:18:49 +0000 (14:18 +0000)]
emacs: Improve the behaviour of the 'q' binding.

When a user hits 'q' in a notmuch buffer, kill the buffer only if
there are no other windows currently showing it.

9 years agotest: use LDFLAGS in test/Makefile.local
Jani Nikula [Mon, 20 Oct 2014 15:03:21 +0000 (18:03 +0300)]
test: use LDFLAGS in test/Makefile.local

Apparently the test binaries are built with minimal LDFLAGS, only
adding dependency specific LDFLAGS as needed. However because some of
the test binaries incorporate notmuch object files, it is necessary to
use the same link flags as notmuch. For example user provided
CFLAGS/CXXFLAGS/LDFLAGS with -fsanitize=undefined fails to build the
test binaries if the flags differ.

9 years agotest: add simple tests for post-insert hook
David Bremner [Sat, 18 Oct 2014 07:22:35 +0000 (09:22 +0200)]
test: add simple tests for post-insert hook

Most of the existing tests for pre/post-new hook don't seem to apply.

9 years agocli/insert: add post-insert hook
Jani Nikula [Sun, 28 Sep 2014 14:40:59 +0000 (17:40 +0300)]
cli/insert: add post-insert hook

The post-new hook might no longer be needed or run very often if
notmuch insert is being used. Therefore a post-insert hook is needed
(arguably pre-insert not so much, so don't add one). Also add the
--no-hooks option to skip hooks.

9 years agogitignore: ignore sh.config and doc/config.dox
Jani Nikula [Mon, 27 Oct 2014 17:59:34 +0000 (19:59 +0200)]
gitignore: ignore sh.config and doc/config.dox

9 years agocli: cast timeval fields to long for format
Jani Nikula [Tue, 28 Oct 2014 08:17:26 +0000 (09:17 +0100)]
cli: cast timeval fields to long for format

This hides platform differences between struct timeval field types.

9 years agoemacs: notmuch-jump.el should provide.
David Edmondson [Wed, 22 Oct 2014 06:05:33 +0000 (07:05 +0100)]
emacs: notmuch-jump.el should provide.

To ease loading, notmuch-jump.el should provide 'notmuch-jump.

9 years agolib: Remove unnecessary thread linking steps when using ghost messages
Austin Clements [Thu, 23 Oct 2014 12:30:41 +0000 (08:30 -0400)]
lib: Remove unnecessary thread linking steps when using ghost messages

Previously, it was necessary to link new messages to children to work
around some (though not all) problems with the old metadata-based
approach to stored thread IDs.  With ghost messages, this is no longer
necessary, so don't bother with child linking when ghost messages are
in use.

9 years agotest: Test upgrade to ghost messages feature
Austin Clements [Thu, 23 Oct 2014 12:30:40 +0000 (08:30 -0400)]
test: Test upgrade to ghost messages feature

9 years agolib: Enable ghost messages feature
Austin Clements [Thu, 23 Oct 2014 12:30:39 +0000 (08:30 -0400)]
lib: Enable ghost messages feature

This fixes the broken thread order test.

9 years agolib: Implement upgrade to ghost messages feature
Austin Clements [Thu, 23 Oct 2014 12:30:38 +0000 (08:30 -0400)]
lib: Implement upgrade to ghost messages feature

Somehow this is the first upgrade pass that actually does *any* error
checking, so this also adds the bit of necessary infrastructure to
handle that.

9 years agolib: Implement ghost-based thread linking
Austin Clements [Thu, 23 Oct 2014 12:30:37 +0000 (08:30 -0400)]
lib: Implement ghost-based thread linking

This updates the thread linking code to use ghost messages instead of
user metadata to link messages into threads.

In contrast with the old approach, this is actually correct.
Previously, thread merging updated only the thread IDs of message
documents, not thread IDs stored in user metadata.  As originally
diagnosed by Mark Walters [1] and as demonstrated by the broken
T260-thread-order test, this can cause notmuch to fail to link
messages even though they're in the same thread.  In principle the old
approach could have been fixed by updating the user metadata thread
IDs as well, but these are not indexed and hence this would have
required a full scan of all stored thread IDs.  Ghost messages solve
this problem naturally by reusing the exact same thread ID and message
ID representation and indexing as regular messages.

Furthermore, thanks to this greater symmetry, ghost messages are also
algorithmically simpler.  We continue to support the old user metadata
format, so this patch can't delete any code, but when we do remove
support for the old format, several functions can simply be deleted.

[1] id:8738h7kv2q.fsf@qmul.ac.uk

9 years agolib: Internal support for querying and creating ghost messages
Austin Clements [Thu, 23 Oct 2014 12:30:36 +0000 (08:30 -0400)]
lib: Internal support for querying and creating ghost messages

This updates the message abstraction to support ghost messages: it
adds a message flag that distinguishes regular messages from ghost
messages, and an internal function for initializing a newly created
(blank) message as a ghost message.

9 years agolib: Introduce macros for bit operations
Austin Clements [Fri, 24 Oct 2014 12:49:15 +0000 (08:49 -0400)]
lib: Introduce macros for bit operations

These macros help clarify basic bit-twiddling code and are written to
be robust against C undefined behavior of shift operators.

9 years agolib: Update database schema doc for ghost messages
Austin Clements [Thu, 23 Oct 2014 12:30:34 +0000 (08:30 -0400)]
lib: Update database schema doc for ghost messages

This describes the structure of ghost mail documents.  Ghost messages
are not yet implemented.

9 years agolib: Add a ghost messages database feature
Austin Clements [Thu, 23 Oct 2014 12:30:33 +0000 (08:30 -0400)]
lib: Add a ghost messages database feature

This will be implemented over the next several patches.  The feature
is not yet "enabled" (this does not add it to
NOTMUCH_FEATURES_CURRENT).

9 years agoMerge tag '0.18.2'
David Bremner [Sat, 25 Oct 2014 16:55:25 +0000 (18:55 +0200)]
Merge tag '0.18.2'

notmuch 0.18.2 release

9 years agodebian: add changelog stanza for 0.18.2-1 0.18.2
David Bremner [Sat, 25 Oct 2014 16:23:33 +0000 (18:23 +0200)]
debian: add changelog stanza for 0.18.2-1

9 years agoversion: bump to 0.18.2
David Bremner [Sat, 25 Oct 2014 16:23:06 +0000 (18:23 +0200)]
version: bump to 0.18.2

No non-documentation changes

9 years agoNEWS: give real entry for 0.18.2
David Bremner [Sat, 25 Oct 2014 10:10:05 +0000 (12:10 +0200)]
NEWS: give real entry for 0.18.2

Expand out what the actual test suite changes are, so people have a
better idea if the release is relevant to them.

9 years agoMerge tag '0.18.2_rc1'
David Bremner [Sat, 25 Oct 2014 09:38:18 +0000 (11:38 +0200)]
Merge tag '0.18.2_rc1'

notmuch 0.18.2~rc1 release

Conflicts:
NEWS
debian/changelog

9 years agodebian: build depend on dh-python 0.18.2_rc1 debian/0.18.2_rc1-1
David Bremner [Sat, 25 Oct 2014 09:20:57 +0000 (11:20 +0200)]
debian: build depend on dh-python

The build log asked me nicely, so I did.

9 years agodebian: add changelog stanza for 0.18.2~rc-1
David Bremner [Sat, 25 Oct 2014 08:48:31 +0000 (10:48 +0200)]
debian: add changelog stanza for 0.18.2~rc-1

9 years agoNEWS: add minimal news item for 0.18.2
David Bremner [Sat, 25 Oct 2014 08:42:00 +0000 (10:42 +0200)]
NEWS: add minimal news item for 0.18.2

The less said, the less typos to make.

9 years agoversion: bump to 0.18.2~rc1
David Bremner [Sat, 25 Oct 2014 08:38:11 +0000 (10:38 +0200)]
version: bump to 0.18.2~rc1

9 years agotest: kill '"filename": "signature.asc"' from json output
David Bremner [Sat, 25 Oct 2014 07:57:12 +0000 (09:57 +0200)]
test: kill '"filename": "signature.asc"' from json output

This starts to appear with emacs24.4, so we can't easily have it in
our expected output.

9 years agotest/emacs: force *Messages* buffer to be writable
David Bremner [Sat, 25 Oct 2014 06:53:29 +0000 (08:53 +0200)]
test/emacs: force *Messages* buffer to be writable

In emacs 24.4 the messages buffer starts being read-only, which kills
these tests.  This seems to be the point of the variable
inihibit-read-only, which has existed at least since emacs 21.

9 years agotest: simplify T360-symbol-hiding, use nm instead of objdump
David Bremner [Wed, 10 Sep 2014 06:41:11 +0000 (08:41 +0200)]
test: simplify T360-symbol-hiding, use nm instead of objdump

After yet another variation in objdump output caused this test to fail
(on a Debian port, no less), I decided whatever putative benefit we
get from looking at the object files instead of the library isn't
worth the maintenence headache.

This version uses nm -P. nm -P should be portable, and fixed format.
It purposely doesn't use the -D argument, since that is non-POSIX and
nm on GNU/Linux seems do the right thing without it.

It still won't work out of the box on e.g. Mac OS/X. I think the right
thing to do there is to move some more configuration information into
sh.config.

(cherry picked from commit c34d6bad0f9da300eac2181e2073aee130432932)

9 years agotest: Port atomicity test to Python
Austin Clements [Fri, 3 Oct 2014 16:58:03 +0000 (12:58 -0400)]
test: Port atomicity test to Python

Previously, this was implemented using a horrible GDB script (because
there is no such thing as a non-horrible GDB script).  This GDB script
often broke with newer versions of GDB for mysterious reasons.  Port
the test script to GDB's Python API, which makes the code much cleaner
and, hopefully, more stable.

(cherry picked from commit cbbda62258360f035894cff9dfd66c60b0cc707f)

Conflicts:
test/T380-atomicity.sh

9 years agoREADME.rst: typo/wording fixes
David Bremner [Fri, 24 Oct 2014 12:23:22 +0000 (14:23 +0200)]
README.rst: typo/wording fixes

It occurs that hardcoding the URL will not make sense in forks.
Mind you, the whole README won't make much sense in forks.

9 years agodoc: add README.rst especially for github
David Bremner [Fri, 24 Oct 2014 08:25:31 +0000 (10:25 +0200)]
doc: add README.rst especially for github

Apparently README.rst overrides README, so this will show up instead
of our generic README on github.

If the user is already on github, then clicking a link for more
information is not a hardship.

9 years agoVIM: Make starting in 'insert' mode for compose optional
Ian Main [Wed, 1 Oct 2014 17:11:28 +0000 (10:11 -0700)]
VIM: Make starting in 'insert' mode for compose optional

This adds a variable to make starting in insert mode optional when
composing and replying to emails.  I found it unusual to be started in
insert mode so I thought I'd make it optional as others may find this as
well.

    Ian

9 years agoVIM: Use notmuch CLI for config
Ian Main [Thu, 2 Oct 2014 23:47:15 +0000 (16:47 -0700)]
VIM: Use notmuch CLI for config

This patch switches from reading .notmuch-config directly to using
the CLI the same way that emacs does it.  It actually uses less code
and is probably less error prone.

    Ian

9 years agotest: check for gdb in insert tests
David Bremner [Sat, 18 Oct 2014 06:13:42 +0000 (08:13 +0200)]
test: check for gdb in insert tests

Commits a6cee01 and c48b12f otherwise break the build for people
without gdb.

9 years agotest/insert: check that indexing errors are accepted with --keep
David Bremner [Fri, 3 Oct 2014 21:19:00 +0000 (23:19 +0200)]
test/insert: check that indexing errors are accepted with --keep

This is overkill for the current code path, but should provide some
robustness for future changes in error handling.

9 years agocli/insert: require succesful message indexing for success status
Jani Nikula [Fri, 3 Oct 2014 21:18:59 +0000 (23:18 +0200)]
cli/insert: require succesful message indexing for success status

Add --keep option to keep any remaining stuff in index or file. We
could distinguish between failures to index and failures to apply tags
or maildir sync, but for simplicity just have one.

9 years agocli/insert: add fail path to add_file_to_database
Jani Nikula [Fri, 3 Oct 2014 21:18:58 +0000 (23:18 +0200)]
cli/insert: add fail path to add_file_to_database

Handle failures gracefully in add_file_to_database, renamed simply
add_file while at it. Add keep option to not remove the message from
database if tagging or tag syncing to maildir flags fails. Expand the
function documentation to cover the changes.

9 years agotest/insert: add known broken tests for indexing failures
David Bremner [Fri, 3 Oct 2014 21:18:57 +0000 (23:18 +0200)]
test/insert: add known broken tests for indexing failures

These tests are written with the assumption that we want all indexing
failures to be considered as failures by notmuch insert.

9 years agolib: Handle empty date value
Austin Clements [Mon, 6 Oct 2014 23:17:09 +0000 (17:17 -0600)]
lib: Handle empty date value

In the interest of robustness, avoid undefined behavior of
sortable_unserialise if the date value is missing.  This shouldn't
happen now, but ghost messages will have blank date values.

9 years agolib: Refactor _notmuch_database_link_message
Austin Clements [Mon, 6 Oct 2014 23:17:08 +0000 (17:17 -0600)]
lib: Refactor _notmuch_database_link_message

This moves the code to retrieve and clear the metadata thread ID out
of _notmuch_database_link_message into its own function.  This will
simplify future changes.

9 years agolib: Move message ID compression to _notmuch_message_create_for_message_id
Austin Clements [Mon, 6 Oct 2014 23:17:07 +0000 (17:17 -0600)]
lib: Move message ID compression to _notmuch_message_create_for_message_id

Previously, this was performed by notmuch_database_add_message.  This
happens to be the only caller currently (which is why this was safe),
but we're about to introduce more callers, and it makes more sense to
put responsibility for ID compression in the lower-level function
rather than requiring each caller to handle it.

9 years agoNEWS: mention the change in default build flags
David Bremner [Sun, 5 Oct 2014 05:53:28 +0000 (07:53 +0200)]
NEWS: mention the change in default build flags

It blows things up by a factor of six or so, so it's worth giving
people a heads up. It won't effect e.g. Debian, that already builds
with -g and then strips.

9 years agoNEWS: Document "nmbug: Translate to Python"
W. Trevor King [Tue, 7 Oct 2014 17:36:13 +0000 (10:36 -0700)]
NEWS: Document "nmbug: Translate to Python"

For more details, see the commit message for 7f2cb3be (nmbug:
Translate to Python, 2014-10-03).  I realized while writing this that
the 7f2cb3be commit message has:

  * 'nmbug log' now execs 'git log', as there's no need to keep the
    Python process around once we've launched Git there.

But we dropped that exec in favor of the subprocess approach between
v3 and v4, I just forgot to update the commit message [1].

[1]: id:e630b6763e9d0771718afee41ea15b29bb4a1de8.1409935538.git.wking@tremily.us
     http://article.gmane.org/gmane.mail.notmuch.general/19007

9 years agohex-escape: remove unused variable default_buf_size
Jani Nikula [Sat, 4 Oct 2014 17:53:09 +0000 (20:53 +0300)]
hex-escape: remove unused variable default_buf_size

Found by clang:

CC  -O2 util/hex-escape.o
util/hex-escape.c:28:21: warning: unused variable 'default_buf_size'
      [-Wunused-const-variable]
static const size_t default_buf_size = 1024;
                    ^
1 warning generated.

9 years agotest: Port atomicity test to Python
Austin Clements [Fri, 3 Oct 2014 16:58:03 +0000 (12:58 -0400)]
test: Port atomicity test to Python

Previously, this was implemented using a horrible GDB script (because
there is no such thing as a non-horrible GDB script).  This GDB script
often broke with newer versions of GDB for mysterious reasons.  Port
the test script to GDB's Python API, which makes the code much cleaner
and, hopefully, more stable.

9 years agoconfigure: add debug flags by default.
David Bremner [Fri, 3 Oct 2014 20:22:10 +0000 (22:22 +0200)]
configure: add debug flags by default.

This makes development (in particular the test suite) easier. Those
concerned about the extra diskspace can override the default or use
strip.

9 years agotest: check for debug symbols in notmuch
David Bremner [Fri, 3 Oct 2014 20:22:09 +0000 (22:22 +0200)]
test: check for debug symbols in notmuch

In the future, tests may rely on debug symbols being present in
notmuch, so we plan to switch the default flags.

The main purpose of this test is to help explain the perhaps
mysterious failures of other tests which rely on symbols being
present.

9 years agonmbug: Translate to Python
W. Trevor King [Fri, 3 Oct 2014 18:20:57 +0000 (11:20 -0700)]
nmbug: Translate to Python

This allows us to capture stdout and stderr separately, and do other
explicit subprocess manipulation without resorting to external
packages.  It should be compatible with Python 2.7 and later
(including the 3.x series).

Most of the user-facing interface is the same, but there are a few
changes, where reproducing the original interface was too difficult or
I saw a change to make the underlying Git UI accessible:

* 'nmbug help' has been split between the general 'nmbug --help' and
  the command-specific 'nmbug COMMAND --help'.

* Commands are no longer split into "most common", "other useful", and
  "less common" sets.  If we need something like this, I'd prefer
  workflow examples highlighting common commands in the module
  docstring (available with 'nmbug --help').

* 'nmbug commit' now only uses a single argument for the optional
  commit-message text.  I wanted to expose more of the underlying 'git
  commit' UI, since I personally like to write my commit messages in
  an editor with the notes added by 'git commit -v' to jog my memory.
  Unfortunately, we're using 'git commit-tree' instead of 'git
  commit', and commit-tree is too low-level for editor-launching.  I'd
  be interested in rewriting commit() to use 'git commit', but that
  seemed like it was outside the scope of this rewrite.  So I'm not
  supporting all of Git's commit syntax in this patch, but I can at
  least match 'git commit -m MESSAGE' in requiring command-line commit
  messages to be a single argument.

* The default repository for 'nmbug push' and 'nmbug fetch' is now the
  current branch's upstream (branch.<name>.remote) instead of
  'origin'.  When we have to, we extract this remote by hand, but
  where possible we just call the Git command without a repository
  argument, and leave it to Git to figure out the default.

* 'nmbug push' accepts multiple refspecs if you want to explicitly
  specify what to push.  Otherwise, the refspec(s) pushed depend on
  push.default.  The Perl version hardcoded 'master' as the pushed
  refspec.

* 'nmbug pull' defaults to the current branch's upstream
  (branch.<name>.remote and branch.<name>.merge) instead of hardcoding
  'origin' and 'master'.  It also supports multiple refspecs if for
  some crazy reason you need an octopus merge (but mostly to avoid
  breaking consistency with 'git pull').

* 'nmbug log' now execs 'git log', as there's no need to keep the
  Python process around once we've launched Git there.

* 'nmbug status' now catches stderr, and doesn't print errors like:

    No upstream configured for branch 'master'

  The Perl implementation had just learned to avoid crashing on that
  case, but wasn't yet catching the dying subprocess's stderr.

* 'nmbug archive' now accepts positional arguments for the tree-ish
  and additional 'git archive' options.  For example, you can run:

    $ nmbug archive HEAD -- --format tar.gz

  I wish I could have preserved the argument order from 'git archive'
  (with the tree-ish at the end), but I'm not sure how to make
  argparse accept arbitrary possitional arguments (some of which take
  arguments).  Flipping the order to put the tree-ish first seemed
  easiest.

* 'nmbug merge' and 'pull' no longer checkout HEAD before running
  their command, because blindly clobbering the index seems overly
  risky.

* In order to avoid creating a dirty index, 'nmbug commit' now uses
  the default index (instead of nmbug.index) for composing the commit.
  That way the index matches the committed tree.  To avoid leaving a
  broken index after a failed commit, I've wrapped the whole thing in
  a try/except block that resets the index to match the pre-commit
  treeish on errors.  That means that 'nmbug commit' will ignore
  anything you've cached in the index via direct Git calls, and you'll
  either end up with an index matching your notmuch tags and the new
  HEAD (after a successful commit) or an index matching the original
  HEAD (after a failed commit).

9 years agodoc: build notmuch-emacs info/html docs, link from index
David Bremner [Sat, 4 Oct 2014 18:47:00 +0000 (20:47 +0200)]
doc: build notmuch-emacs info/html docs, link from index

Although this manual is far from complete, it may be helpful for
someone. In particular building it as part of the standard build
process makes it easier to find problems when editing the
notmuch-emacs-manual.

9 years agodoc: Emacs manual improvements and expansions
Austin Clements [Fri, 3 Oct 2014 14:27:26 +0000 (10:27 -0400)]
doc: Emacs manual improvements and expansions

Fix several typos, improve general wording and flow, and add some
information on notmuch-jump.

9 years agoNEWS: News for notmuch-jump
Austin Clements [Fri, 3 Oct 2014 14:22:59 +0000 (10:22 -0400)]
NEWS: News for notmuch-jump

9 years agolib: Simplify close and codify aborting atomic section
Austin Clements [Thu, 2 Oct 2014 19:19:08 +0000 (15:19 -0400)]
lib: Simplify close and codify aborting atomic section

In Xapian, closing a database implicitly aborts any outstanding
transaction and commits changes.  For historical reasons,
notmuch_database_close had grown to almost, but not quite duplicate
this behavior.  Before closing the database, it would explicitly (and
unnecessarily) commit it.  However, if there was an outstanding
transaction (ie atomic section), commit would throw a Xapian
exception, which notmuch_database_close would unnecessarily print to
stderr, even though notmuch_database_close would ultimately abort the
transaction anyway when it called close.

This patch simplifies notmuch_database_close to explicitly abort any
outstanding transaction and then just call Database::close.  This
works for both read-only and read/write databases, takes care of
committing changes, unifies the exception handling path, and codifies
aborting outstanding transactions.  This is currently the only way to
abort an atomic section (and may remain so, since it would be
difficult to roll back things we may have cached from rolled-back
modifications).

9 years agocli/insert: rehash file writing functions
Jani Nikula [Mon, 22 Sep 2014 09:54:59 +0000 (11:54 +0200)]
cli/insert: rehash file writing functions

Make the function calls make more sense as independent building blocks
of the big picture, with clear inputs and outputs. Split up
write_message into two. Improve function documentation. Cleanup and
clarify the error paths.

9 years agocli/insert: abstract temporary filename generation
Jani Nikula [Mon, 22 Sep 2014 09:54:58 +0000 (11:54 +0200)]
cli/insert: abstract temporary filename generation

This will clean up the usage. There's the slight functional change of
potentially ending up doing extra gethostname and getpid calls, but
this is neglible.

9 years agocli/insert: use a single recursive mkdir function
Jani Nikula [Mon, 22 Sep 2014 09:54:57 +0000 (11:54 +0200)]
cli/insert: use a single recursive mkdir function

Combine make_directory() and make_directory_and_parents() into a
single recursive mkdir_recursive() function. Clarify the code and
improve error handling. Improve error messages. Switch to using the
new function in maildir_create_folder(). Constify talloc context.

9 years agocli/insert: clean up sync_dir
Jani Nikula [Mon, 22 Sep 2014 09:54:56 +0000 (11:54 +0200)]
cli/insert: clean up sync_dir

Clarify the code slightly, improve error messages. Apart from the
error message changes, no functional changes.

9 years agocli/insert: rename file copy function
Jani Nikula [Mon, 22 Sep 2014 09:54:55 +0000 (11:54 +0200)]
cli/insert: rename file copy function

The copying has nothing to do with stdin, so call it copy_fd
instead. While at it, improve documentation and reverse the
parameters, as destination is traditionally the first parameter.

9 years agocli/insert: move add_file_to_database to a better place
Jani Nikula [Mon, 22 Sep 2014 09:54:54 +0000 (11:54 +0200)]
cli/insert: move add_file_to_database to a better place

Move add_file_to_database around to keep the filesystem related
functions grouped together, improving readability. No functional
changes.

9 years agocli/insert: rename check_folder_name to is_valid_folder_name
Jani Nikula [Mon, 22 Sep 2014 09:54:53 +0000 (11:54 +0200)]
cli/insert: rename check_folder_name to is_valid_folder_name

An "is something" predicate conveys the meaning better. While at it,
improve the function documentation and error message. Besides the
error message change, no functional changes.

9 years agolib: actually return failures from notmuch_message_tags_to_maildir_flags
Jani Nikula [Mon, 22 Sep 2014 09:54:52 +0000 (11:54 +0200)]
lib: actually return failures from notmuch_message_tags_to_maildir_flags

The function takes great care to preserve the first error status it
encounters, yet fails to return that status to the caller. Fix it.

9 years agoemacs: jump: fix compile warning on emacs 23
Mark Walters [Thu, 4 Sep 2014 09:46:54 +0000 (10:46 +0100)]
emacs: jump: fix compile warning on emacs 23

notmuch-jump uses window-body-width which is not defined in emacs
23. To get around this it does

(unless (fboundp 'window-body-width)
  ;; Compatibility for Emacs pre-24
  (defalias 'window-body-width 'window-width))

This makes sure window-body-width is defined and all should be
well. But it seems that the byte compiler does not realise that this
guarantees that window-body-width will be defined and so, when
compiling with emacs 23, it gives an error

In end of data:
notmuch-jump.el:172:1:Warning: the function `window-body-width' is not known to be defined.

Domo and I came to following on irc: wrap the (unless (fboundp ...))
inside eval-and-compile which ensures that both the test and the
defalias (if needed) happen at both compile and load time.  This fixes
the warning.

9 years agopython: Add binding for notmuch_query_add_tag_exclude
Thibaut Horel [Mon, 11 Aug 2014 04:43:54 +0000 (00:43 -0400)]
python: Add binding for notmuch_query_add_tag_exclude

Implemented as the method `exclude_tag` of the class `Query`. This method takes
one argument, a string containing the name of the tag to exclude.

9 years agoemacs: Fix coding system in `notmuch-show-view-raw-message'
Austin Clements [Mon, 21 Apr 2014 18:37:40 +0000 (14:37 -0400)]
emacs: Fix coding system in `notmuch-show-view-raw-message'

This fixes the known-broken test of viewing 8bit messages added by the
previous commit.

9 years agotest: New tests for Emacs charset handling
Austin Clements [Mon, 21 Apr 2014 18:37:39 +0000 (14:37 -0400)]
test: New tests for Emacs charset handling

The test of viewing 8bit messages is known-broken.  The rest pass, but
for very fragile reasons.  The next several commits will fix the
known-broken test and make our charset handling robust.

9 years agoemacs: Remove redundant NTH argument from `notmuch-get-bodypart-content'.
Austin Clements [Mon, 21 Apr 2014 18:37:38 +0000 (14:37 -0400)]
emacs: Remove redundant NTH argument from `notmuch-get-bodypart-content'.

This can be derived from the PART argument (which is arguably
canonical), so there's no sense in giving the caller an extra foot
gun.

9 years agotest/emacs: globally force the html renderer to html2text
David Bremner [Sat, 20 Sep 2014 05:41:35 +0000 (07:41 +0200)]
test/emacs: globally force the html renderer to html2text

Previously we did this for a single test, but some other proposed
tests ( id:1398105468-14317-3-git-send-email-amdragon@mit.edu ) show
similar breakage when switching renderers.

9 years agodebian: re-enable atomicity test on arm64
David Bremner [Sat, 20 Sep 2014 07:51:48 +0000 (09:51 +0200)]
debian: re-enable atomicity test on arm64

according to

   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=757454

the kernel problem which caused this test to fail should be
fixed now

9 years agodebian: bump SONAME
David Bremner [Tue, 16 Sep 2014 19:02:50 +0000 (21:02 +0200)]
debian: bump SONAME

Note that this is one of those cases where an ABI change is not
obvious from the symbols file. Several previously void functions now
have return codes.

9 years agopython: bump SONAME
David Bremner [Tue, 16 Sep 2014 18:50:57 +0000 (20:50 +0200)]
python: bump SONAME

This should have happened in commit 6754ad9f9, but oops.

This was not caught by our test suite because it uses an installed
notmuch library of it cannot find the just built one.

9 years agocli: refactor insert
Peter Wang [Wed, 16 Apr 2014 12:59:21 +0000 (22:59 +1000)]
cli: refactor insert

Change insert_message into write_message and move its responsibilities
for indexing the message into the main function, to simplify the control
flow.

9 years agoruby: handle return status of database close
Peter Wang [Wed, 16 Apr 2014 12:59:20 +0000 (22:59 +1000)]
ruby: handle return status of database close

Throw an exception if notmuch_database_destroy fails.

9 years agogo: add return status to database close method
Peter Wang [Wed, 16 Apr 2014 12:59:19 +0000 (22:59 +1000)]
go: add return status to database close method

Add return status to the Database.Close() method that calls
notmuch_database_destroy.

9 years agopython: handle return status of database close and destroy
Peter Wang [Wed, 16 Apr 2014 12:59:18 +0000 (22:59 +1000)]
python: handle return status of database close and destroy

Throw an exception if notmuch_database_close or notmuch_database_destroy
fail.

9 years agolib: bump soname
Peter Wang [Wed, 16 Apr 2014 12:59:17 +0000 (22:59 +1000)]
lib: bump soname

Adding return values to notmuch_database_close and
notmuch_database_destroy may require bumping the soname.

9 years agotest: simplify T360-symbol-hiding, use nm instead of objdump
David Bremner [Wed, 10 Sep 2014 06:41:11 +0000 (08:41 +0200)]
test: simplify T360-symbol-hiding, use nm instead of objdump

After yet another variation in objdump output caused this test to fail
(on a Debian port, no less), I decided whatever putative benefit we
get from looking at the object files instead of the library isn't
worth the maintenence headache.

This version uses nm -P. nm -P should be portable, and fixed format.
It purposely doesn't use the -D argument, since that is non-POSIX and
nm on GNU/Linux seems do the right thing without it.

It still won't work out of the box on e.g. Mac OS/X. I think the right
thing to do there is to move some more configuration information into
sh.config.

9 years agonotmuch_thread_get_authors: document match grouping with |
Gaute Hope [Wed, 10 Sep 2014 07:24:18 +0000 (09:24 +0200)]
notmuch_thread_get_authors: document match grouping with |

as stated in thread.cc:115

/* Construct an authors string from matched_authors_array and
 * authors_array. The string contains matched authors first, then
 * non-matched authors (with the two groups separated by '|'). Within
 * each group, authors are listed in date order. */

this is, however, not reflected in the public API documentation in
notmuch.h:970. This patch a paragraph explaining how | separates the
group of authors of messages matching the query and those of messages
that do not, but are still contained in the thread.

9 years agoemacs: jump: sort-order bugfix
Mark Walters [Tue, 2 Sep 2014 18:56:04 +0000 (19:56 +0100)]
emacs: jump: sort-order bugfix

default-value needs its argument to be quoted.

Slightly strangely default-value of 't or nil is 't or nil
respectively so the code

(default-value notmuch-search-oldest-first)

just gives the current value of notmuch-search-oldest-first rather
than intended default-value of this variable.

The symptom is that if you are in a search buffer and use notmuch jump
to run a saved search which does not have an explicitly set sort order
then the sort order of the saved-search is inherited from the current
search buffer rather than being the default search order.

Thanks to Jani for finding the bug.

9 years agocli: Be more helpful when .notmuch-config does not exist
Austin Clements [Wed, 3 Sep 2014 15:28:34 +0000 (11:28 -0400)]
cli: Be more helpful when .notmuch-config does not exist

Previously, if the user ran any subcommand that required a
configuration (e.g., notmuch new) but didn't have a configuration,
notmuch would give the rather un-friendly and un-actionable message

  Error reading configuration file .notmuch-config: No such file or directory

Since this condition is expected for new users, this patch adds
specific handling for the file-not-found case to give a message that
is friendly and actionable.

9 years agodoc: 'rm -f' potential doxygen temporary output file
Tomi Ollila [Mon, 1 Sep 2014 18:44:59 +0000 (21:44 +0300)]
doc: 'rm -f' potential doxygen temporary output file

Some (older) Doxygen versions do not create such a temporary file.

9 years agolib: Fix endless upgrade problem
Austin Clements [Mon, 1 Sep 2014 22:49:07 +0000 (18:49 -0400)]
lib: Fix endless upgrade problem

48db8c8 introduced a disagreement between when
notmuch_database_needs_upgrade returned TRUE and when
notmuch_database_upgrade actually performed an upgrade.  As a result,
if a database had a version less than 3, but no new features were
required, notmuch new would call notmuch_database_upgrade to perform
an upgrade, but notmuch_database_upgrade would return immediately
without updating the database version.  Hence, the next notmuch new
would do the same, and so on.

Fix this by ensuring that the upgrade-required logic is identical
between the two.

9 years agolib: Update doc of notmuch_database_{needs_upgrade,upgrade}
Austin Clements [Mon, 25 Aug 2014 17:26:09 +0000 (13:26 -0400)]
lib: Update doc of notmuch_database_{needs_upgrade,upgrade}

Clients are no longer required to call these functions after opening a
database in read/write mode (which is good, because almost none of
them do!).

9 years agolib: Return an error from operations that require an upgrade
Austin Clements [Mon, 25 Aug 2014 17:26:08 +0000 (13:26 -0400)]
lib: Return an error from operations that require an upgrade

Previously, there was no protection against a caller invoking an
operation on an old database version that would effectively corrupt
the database by treating it like a newer version.

According to notmuch.h, any caller that opens the database in
read/write mode is supposed to check if the database needs upgrading
and perform an upgrade if it does.  This would protect against this,
but nobody (even the CLI) actually does this.

However, with features, it's easy to protect against incompatible
operations on a fine-grained basis.  This lightweight change allows
callers to safely operate on old database versions, while preventing
specific operations that would corrupt the database with an
informative error message.

9 years agolib: Support empty header values in database
Austin Clements [Mon, 25 Aug 2014 17:26:07 +0000 (13:26 -0400)]
lib: Support empty header values in database

Commit 567bcbc2 introduced support for storing various headers in
document values.  However, doing so in a backwards-compatible way
meant that genuinely empty header values could not be distinguished
from the old behavior of not storing the headers at all, so these
required parsing the original message.

Now that we have database features, new databases can declare that all
messages have header values, so if we have this feature flag, we can
use the stored header value even if it's the empty string.

This requires slight cleanup to notmuch_message_get_header, since the
code previously couldn't distinguish between empty headers and headers
that are never stored in the database (previously this distinction
didn't matter).