David Bremner [Fri, 21 Oct 2011 22:09:49 +0000 (19:09 -0300)]
docs: Update news, man page, and online help for restore --accumulate
As a side effect, reformat the NEWs entry for notmuch dump for
consistency with the notmuch restore NEWS submitted by Thomas
Schwinge.
David Bremner [Fri, 21 Oct 2011 18:46:54 +0000 (15:46 -0300)]
notmuch-restore: check for extra arguments.
We consider it an error to pass more than one file to restore, since
extra ones are ignored.
David Bremner [Wed, 19 Oct 2011 21:18:24 +0000 (18:18 -0300)]
notmuch-restore: implement --accumulate option
Modify command line argument handling to take a --accumulate flag.
Test for extra arguments beyond the input file.
The --accumulate switch causes the union of the existing and new tags to be
applied, instead of replacing each message's tags as they are read in from the
dump file.
Based on a patch by Thomas Schwinge:
id:"
1317317857-29636-1-git-send-email-thomas@schwinge.name"
David Bremner [Fri, 21 Oct 2011 16:04:46 +0000 (13:04 -0300)]
test/dump-restore: add tests for restore --accumulate
Flesh out what ``notmuch restore --accumulate'' is supposed to do.
Its tests are currently XFAILed; the functionality will be added in
future patch(es).
Based on a patch by Thomas Schwinge:
id:"
1317317811-29540-1-git-send-email-thomas@schwinge.name"
David Bremner [Fri, 21 Oct 2011 22:08:11 +0000 (19:08 -0300)]
notmuch.1: typo fixes new wording for dump/restore
These changes were included in Thomas's restore --accumulate patch,
but are actually more generally applicable.
David Bremner [Fri, 21 Oct 2011 00:14:30 +0000 (21:14 -0300)]
test/dump-restore: Fix quoting on grep
Thanks to Thomas Schwinge for noticing yet another place where quoting
matters. Since the shell translates \. to ., the regex passed to grep
is too generous without the quotes.
The use of [.] is the suggestion of Tomi Ollila.
David Bremner [Wed, 19 Oct 2011 21:03:12 +0000 (18:03 -0300)]
test/dump-restore: expand test suite for dump-restore, make more robust
Several new tests are added, and existing use of test_begin_subtest is
replaced by test_expect_success to catch failing commands in cases where
we execute more than one command.
Based on changes in
id:"
1317317811-29540-1-git-send-email-thomas@schwinge.name"
David Bremner [Wed, 19 Oct 2011 20:51:24 +0000 (17:51 -0300)]
test/test-lib.sh: update comments
- explain test_expect_equal_file
- remove mention of test_expect_failure, since that function was removed.
Based on id:"
1317317811-29540-1-git-send-email-thomas@schwinge.name"
David Bremner [Fri, 21 Oct 2011 12:19:17 +0000 (09:19 -0300)]
cli: change argument parsing convention for subcommands
previously we deleted the subcommand name from argv before passing to
the subcommand. In this version, the deletion is done in the actual
subcommands. Although this causes some duplication of code, it allows
us to be more flexible about how we parse command line arguments in
the subcommand, including possibly using off-the-shelf routines like
getopt_long that expect the name of the command in argv[0].
David Bremner [Wed, 12 Oct 2011 21:34:43 +0000 (18:34 -0300)]
docs: Update man page, NEWS and online help for new dump arguments.
We mention in all three places that using the filename argument is
deprecated.
David Bremner [Mon, 10 Oct 2011 13:44:07 +0000 (10:44 -0300)]
notmuch-dump: deprecate use of output file argument.
We print an intentionally non-specific message on stderr, since it
isn't clear if there will be some global output file argument to
replace.
We update the test suite atomically, since it relies on having the
same text in two files.
David Bremner [Sun, 9 Oct 2011 14:12:30 +0000 (11:12 -0300)]
notmuch-dump: treat any remaining arguments after the filename as search terms
The main motivation here is allow the fast dumping of tag data for
messages having certain tags. In practice it seems too slow to pipe
dump to grep.
All dump-restore tests should be working now, so we update test/dump-restore
accordingly
David Bremner [Sun, 9 Oct 2011 13:57:03 +0000 (10:57 -0300)]
notmuch-dump: update handling of file name argument
We permit -- as an "option processing terminator".
Currently this does not do anything useful, but we plan to add
search terms after the --.
David Bremner [Mon, 10 Oct 2011 12:27:20 +0000 (09:27 -0300)]
test: add tests for command line arguments to notmuch-dump
The plan is to add the possibility of search terms after the file name,
and the use of -- to stop looking for an output file name.
David Bremner [Sun, 9 Oct 2011 13:29:22 +0000 (10:29 -0300)]
test: update dump-restore to use redirection instead of filename args
The idea here is that we want to deprecate the use of arguments to
dump and restore to specify paths, since in particular we want to use
the non-option arguments to dump to form a query.
David Bremner [Wed, 12 Oct 2011 00:53:57 +0000 (21:53 -0300)]
debian: changelog stanza for 0.9
Admit that there have been no changes since the last release
candidate.
David Bremner [Wed, 12 Oct 2011 00:50:56 +0000 (21:50 -0300)]
version: bump to 0.9
also bump python bindings version.
David Bremner [Tue, 11 Oct 2011 12:10:33 +0000 (09:10 -0300)]
NEWS: document API changes to n_d_find_message{,_by_filename}
For details the user will have to refer to the source. Reformat Ruby
news consistently with Python.
David Bremner [Tue, 11 Oct 2011 12:05:41 +0000 (09:05 -0300)]
NEWS: document API changes to n_d_find_message{,_by_filename}
For details the user will have to refer to the source.
Jameson Graef Rollins [Sun, 9 Oct 2011 03:21:26 +0000 (20:21 -0700)]
test: add two emacs tests for show mode refresh
The first test tests that the notmuch-show-refresh-view function
produces the exact same output for an unmodified show buffer. This
test should pass since the relevant functionality has already been
applied.
The second test tests show refresh for a show buffer that has been
modified by navigation and message visibility toggling. Ideally
refresh-view should preserve this state of the notmuch-show buffer.
Unfortunately it currently does not, so this test is know to be broken
and is marked as such.
Jameson Graef Rollins [Sun, 9 Oct 2011 03:47:47 +0000 (20:47 -0700)]
NEWS: add notes about emacs improvements and reply formating cleanup
David Bremner [Sat, 8 Oct 2011 01:42:18 +0000 (22:42 -0300)]
version: bump to 0.9~rc2
We continue to keep the python bindings version in sync manually
David Bremner [Fri, 7 Oct 2011 21:54:27 +0000 (18:54 -0300)]
debian: update changelog for 0.9~rc2-1
Document upstream changes since 0.9~rc1-1
Jameson Graef Rollins [Sun, 29 May 2011 00:09:43 +0000 (17:09 -0700)]
emacs: add notmuch-show-refresh-view function
This function, like the equivalent for notmuch-search, just refreshes
the current show view. Like in notmuch-search, this new function is
bound to "=". If a prefix is given then the redisplay happens with the
crypto-switch set, which displays the thread with the opposite logic
of whatever is set in the notmuch-crypto-process-mime customization
variable.
Jameson Graef Rollins [Tue, 31 May 2011 17:07:13 +0000 (10:07 -0700)]
emacs: Add callback functions to crypto sigstatus button.
This adds two callback functions to the sigstatus button. If the sig
status is "good", then clicking the button displays the output of "gpg
--list-keys" on the key fingerprint. If the sigstatus is "bad", then
clicking the button will retrieve the key from the keyserver, and
redisplay the current buffer.
Thanks to David Bremner <bremner@unb.ca> for help with this.
Jameson Graef Rollins [Wed, 8 Jun 2011 19:30:09 +0000 (12:30 -0700)]
Ignore "application/pgp-*" parts in reply.
The quoted text doesn't need to mention that the message being replied
to had these crufty parts.
Jameson Graef Rollins [Wed, 8 Jun 2011 19:30:08 +0000 (12:30 -0700)]
test: test for absence of "Non-text part: application/pgp-*" lines in reply
In reply, the quoted text does not need to mention that the original
message had "application/pgp-signed" or "application/pgp-encrypted"
parts.
Jameson Graef Rollins [Wed, 8 Jun 2011 19:30:07 +0000 (12:30 -0700)]
Fix notmuch-reply to not output "Non-text part:" lines for non-leafnode parts.
These lines are just cruft in this case, and can be removed.
Jameson Graef Rollins [Wed, 8 Jun 2011 19:30:06 +0000 (12:30 -0700)]
test/multipart: test for absence of "Non-text part:" lines in reply for multipart/* and message/rfc822 parts
There's no reason to output "Non-text part:" lines for parts that are
not leaf nodes, eg. multipart/* and message/rfc822. We fix the text
here to test for their absence. The next patch will fix reply
accordingly.
Sebastian Spaeth [Wed, 5 Oct 2011 15:57:46 +0000 (17:57 +0200)]
python: Set status in the class definitions
Technically, this is a superfluous change, as the self.status variable
currently gets set in NotmuchErrors's __new__ function. However, in the
long run I would like to get rid of the weird __new__ implementation which
might be somewhat confusing for users (NotmuchError(status) returns a
different class, e.g. OutOfMemoryError)
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Sebastian Spaeth [Wed, 5 Oct 2011 15:55:30 +0000 (17:55 +0200)]
python: help function Query._assert_query_is_initialized
Remove code duplication by using the new helper function. Also raise the
new fine grained exceptions in many cases, rather than the more generic
NotmuchErrors.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Sebastian Spaeth [Wed, 5 Oct 2011 15:54:09 +0000 (17:54 +0200)]
python: clean up docstrings and API documentation
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Sebastian Spaeth [Wed, 5 Oct 2011 15:05:37 +0000 (17:05 +0200)]
python: whitespace fixed in docstrings
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Sebastian Spaeth [Wed, 5 Oct 2011 14:58:13 +0000 (16:58 +0200)]
python: Add the new exception types in the API documentation
as they should be documented...
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Sebastian Spaeth [Wed, 5 Oct 2011 14:44:35 +0000 (16:44 +0200)]
python: Catch up with find_message(by_filename) API changes
message is now an out parameter, and we get an additional status code as
a result. Hurray \o/.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Sebastian Spaeth [Wed, 5 Oct 2011 13:46:03 +0000 (15:46 +0200)]
python: also use libnotmuch.so.2
Catch up with the major version bump. I wonder if this could somehow be
automatically made the correct version number. Oh well, I hope it
doesn't change too often :-).
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
David Bremner [Tue, 4 Oct 2011 17:01:21 +0000 (14:01 -0300)]
debian: update packaging for new soname
we need
- a new changelog stanza, because the symbols files need a new version
- s/libnotmuch1/libnotmuch2/ everywhere
- update symbols file, s/.so.1/.so.2/, and bump minimum versions on changed
symbols (although the latter is just documentation)
David Bremner [Tue, 4 Oct 2011 16:47:04 +0000 (13:47 -0300)]
lib: bump SONAME
Based on discussions with amdragon, tschwinge, and others on IRC, I concluded that
1) symbol versioning was probably overkill for libnotmuch
2) It was also probably GNU ld specific
3) Most importantly, nobody could tell me on short notice how exactly it works.
So since the change to the notmuch_database_find_message breaks the
previous ABI, we need to bump the SONAME.
Ali Polatel [Tue, 4 Oct 2011 13:57:33 +0000 (16:57 +0300)]
ruby: Fix macros, use quoting
Fix Data_Get_Notmuch_* macro definitions broken by prev. commit
Adequate quoting for Data_Get_Notmuch_* macros
Remove duplicated RSTRING_PTR() macros, move it to defs.h
Ali Polatel [Tue, 4 Oct 2011 13:48:34 +0000 (16:48 +0300)]
ruby: Really add wrappers for database_find_message*
Commit
898613116db746aa0f915ae43da8aba28545203d only added wrapper
functions but did not register them. Register the functions in module's
initialization function.
Ali Polatel [Tue, 4 Oct 2011 13:41:52 +0000 (16:41 +0300)]
ruby: be consistent with notmuch's coding style
No functional change, just indentation
Ali Polatel [Tue, 4 Oct 2011 13:06:20 +0000 (16:06 +0300)]
ruby: Add wrappers for database_find_message*
Two new wrappers:
Notmuch::Database.find_message(id) => Notmuch::Message or nil
Notmuch::Database.find_message_by_filename(path) => Notmuch::Message or nil
David Bremner [Tue, 4 Oct 2011 10:35:40 +0000 (07:35 -0300)]
Merge remote-tracking branch 'alip/find_message-v3'
Ali Polatel [Tue, 4 Oct 2011 04:55:29 +0000 (07:55 +0300)]
lib: make find_message{,by_filename) report errors
Previously, the functions notmuch_database_find_message() and
notmuch_database_find_message_by_filename() functions did not properly
report error condition to the library user.
For more information, read the thread on the notmuch mailing list
starting with my mail "id:871uv2unfd.fsf@gmail.com"
Make these functions accept a pointer to 'notmuch_message_t' as argument
and return notmuch_status_t which may be used to check for any error
condition.
restore: Modify for the new notmuch_database_find_message()
new: Modify for the new notmuch_database_find_message_by_filename()
Ali Polatel [Mon, 3 Oct 2011 20:27:32 +0000 (23:27 +0300)]
lib: destroy message object after message removal
notmuch_database_remove_message() must call notmuch_message_destroy()
once it is done handling message removal.
Thomas Jost [Fri, 30 Sep 2011 10:16:47 +0000 (12:16 +0200)]
python: fix Message.get_filenames()
Previously, the Filenames generator only yielded *one* filename before
returning, making Message.get_filenames() behave as Message.get_filename(). This
commit fixes this incorrect behavior: now the generator yields all the
filenames, as expected.
Sebastian Spaeth [Fri, 30 Sep 2011 14:04:42 +0000 (16:04 +0200)]
python: rework creating of Subclasses
Add some smart magic, so that when we invoke a
NotmuchError(STATUSVALUE), a nicely derived subclass is created, e.g. a
OutOfMemoryError. This way users can easily distinguish between error
types, while still catching NotmuchError.
I have tested this, and hope it works for others too.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Justus Winter [Mon, 26 Sep 2011 01:05:35 +0000 (03:05 +0200)]
python: provide more exception classes
To make the exception handling more effective in code using the
python bindings it is necessary to differentiate between the
different kind of failures.
Add an exception class for each status code and add a decode
classmethod to the NotmuchError class that acts as a factory.
Import the new classes in __init__.py so they can be easily
imported by anyone.
Patch modifed by Sebastian Spaeth.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
Justus Winter [Fri, 30 Sep 2011 01:05:04 +0000 (03:05 +0200)]
python: fix docstring of Message.get_header()
Update the docstring from notmuch.h.
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
Sebastian Spaeth [Thu, 29 Sep 2011 09:00:43 +0000 (11:00 +0200)]
python: Add new functions in API documentation
Add documentation for the three new functions and add in which version
they have been added.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Sebastian Spaeth [Thu, 29 Sep 2011 08:47:28 +0000 (10:47 +0200)]
python: Improve code documentation
1) Fix added .gitignore from commit
dc8a1745 to work on the docs folder
2) Improve in-code developer documentation to produce better
sphinx-generated documentation. No code changes.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Sebastian Spaeth [Thu, 29 Sep 2011 07:55:14 +0000 (09:55 +0200)]
NEWS: Note implementation bug for python binding
Make note that find_message_by_name currently crashes the python process
if the Database is READ-ONLY. This should be fixed in the underlying
libnotmuch.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Sebastian Spaeth [Thu, 29 Sep 2011 07:51:42 +0000 (09:51 +0200)]
NEWS: Update with python binding news
List major changes.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Justus Winter [Sun, 25 Sep 2011 21:07:35 +0000 (23:07 +0200)]
properly raise exceptions in python bindings
There are various locations where exceptions are constructed but
not raised. This patch adds the necessary raise statements.
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
Justus Winter [Mon, 26 Sep 2011 01:05:37 +0000 (03:05 +0200)]
python: raise a more specific error in Messages.print_messages
Raising Exception is considered bad since the only way to catch
it is to do 'except Exception'. Raising a TypeError is more
appropriate.
Since the format parameter has already been validated, checking
it again is not necessary. Simplify this conditional.
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
Justus Winter [Mon, 26 Sep 2011 01:05:34 +0000 (03:05 +0200)]
python: rename _verify_dir_initialized to _assert_dir_is_initialized
Rename the function to clarify its effect and remove all the comments
accompanying each call to the function.
Modified by Sebastian Spaeth to apply cleanly again and remove some
blank lines.
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Justus Winter [Mon, 26 Sep 2011 01:05:33 +0000 (03:05 +0200)]
python: rename _verify_initialized_db to _assert_db_is_initialized
Rename the function to clarify its effect and remove all the comments
accompanying each call to the function.
Modified slightly by Sebastian Spaeth to catch all new instances and
remove some blank lines too.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
Justus Winter [Mon, 26 Sep 2011 01:05:32 +0000 (03:05 +0200)]
python: fix NotmuchError.__str__ if status == None
Passing None to STATUS.status2str raises an ArgumentError. Add a
check for this case and provide a generic message.
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
Justus Winter [Mon, 26 Sep 2011 01:05:30 +0000 (03:05 +0200)]
python: add status and message attributes to NotmuchError
Providing exception objects with meaningful attribute names
is much nicer than using e.args[].
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
Justus Winter [Mon, 26 Sep 2011 01:05:29 +0000 (03:05 +0200)]
python: add a .gitignore file and refine the toplevel one
The line 'notmuch' in the toplevel .gitignore file is to broad
and matches bindings/python/notmuch making it cumbersome to
git-add files within that directory.
Refine the toplevel file to only match the generated notmuch
executable and add a more specialized .gitignore file to the
python directory.
Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
Sebastian Spaeth [Wed, 28 Sep 2011 15:50:57 +0000 (17:50 +0200)]
python: add begin|end_atomic bindings
* Add UNBALANCED_ATOMIC status code
Catch up with the notmuch status codes, and add the UNBALANCED_ATOMIC
one.
* Add the begin_atomic and end_atomic calls to libnotmuch
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Sebastian Spaeth [Wed, 28 Sep 2011 16:27:44 +0000 (18:27 +0200)]
python: Add database_find_message_by_filename bindings
Add it :-)
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
David Bremner [Mon, 26 Sep 2011 23:27:42 +0000 (20:27 -0300)]
NEWS: add item for python bindings.
Just the one unicode related change this release.
David Bremner [Mon, 26 Sep 2011 23:23:23 +0000 (20:23 -0300)]
NEWS: add item for Ruby bindings.
This is based on a quick scan of git log.
David Bremner [Mon, 26 Sep 2011 23:18:55 +0000 (20:18 -0300)]
NEWS: start release notes for 0.9
Thanks to Austin Clements for providing these notes, and the patches
they describe.
David Bremner [Sun, 25 Sep 2011 14:27:03 +0000 (11:27 -0300)]
debian: add brief summary of changes since 0.8
David Bremner [Sun, 25 Sep 2011 14:16:06 +0000 (11:16 -0300)]
debian: build-depend on gdb
This is needed to enable the atomicity tests at build time.
David Bremner [Sun, 25 Sep 2011 12:12:48 +0000 (09:12 -0300)]
test/atomicity: redirect output from "which"
Without redirection, this produced some slightly confusing output in
case gdb was present.
David Bremner [Sun, 25 Sep 2011 02:15:01 +0000 (23:15 -0300)]
debian: close bug 642240
The bug was really closed by the commit that updated the dependency,
of course.
David Bremner [Sun, 25 Sep 2011 01:45:33 +0000 (22:45 -0300)]
test: make atomicity setup conditional on gdb being present.
The setup is useless if gdb is not present, so it doesn't hurt to skip
it. The diff here is huge, but the commit is really just moving most
of the script inside the initial if, and adding an else block to print
a warning.
David Bremner [Sat, 24 Sep 2011 19:13:49 +0000 (16:13 -0300)]
lib: bump library minor version because of new symbols.
This bump is because of the new symbols introduced by the atomicity
patches.
David Bremner [Sat, 24 Sep 2011 18:37:27 +0000 (14:37 -0400)]
debian: set versioned dependency on notmuch for notmuch-emacs
As long as we have no version information in the json output, this
seems like the only possible way of ensuring that the emacs client
code understands the output from the command line tool notmuch.
David Bremner [Sat, 24 Sep 2011 16:19:32 +0000 (12:19 -0400)]
version: bump to 0.9~rc1
This version number change should not be taken as definitive, rather
refer to the signed tag.
David Bremner [Sat, 24 Sep 2011 16:15:47 +0000 (12:15 -0400)]
debian: changlog stanza for release candidate
David Bremner [Sat, 24 Sep 2011 18:17:44 +0000 (14:17 -0400)]
debian: new symbols for atomicity api
There are three new symbols in libnotmuch. In addition to notmuch_{begin,end)_atomic,
notmuch_database_find_message_by_filename was exposed.
Austin Clements [Sat, 11 Jun 2011 19:34:11 +0000 (15:34 -0400)]
lib: Improve notmuch_database_{add,remove}_message documentation.
State up front that these functions may add a filename to an existing
message or remove only a filename (and not the message), respectively.
Previously, this key information was buried in return value
documentation or in "notes", which made it seem secondary to these
functions' semantics.
Austin Clements [Sat, 29 Jan 2011 16:25:56 +0000 (11:25 -0500)]
new: Wrap adding and removing messages in atomic sections.
This addresses atomicity of tag synchronization, the last atomicity
problems in notmuch new. Each message add or remove is wrapped in its
own atomic section, so interrupting notmuch new doesn't lose progress.
Austin Clements [Fri, 28 Jan 2011 01:51:04 +0000 (20:51 -0500)]
new: Synchronize maildir flags eagerly.
Because flag synchronization is stateless, it can be performed at any
time as long as it's guaranteed to be performed after any change to a
message's filename list. Take advantage of this to synchronize tags
immediately after a filename is added or removed.
This does not yet make adding or removing a message atomic, but it is
a big step toward atomicity because it reduces the window where the
database tags are inconsistent from nearly the entire notmuch-new to
just around when the message is added or removed.
Austin Clements [Sun, 6 Feb 2011 09:28:01 +0000 (04:28 -0500)]
new: Cleanup. De-duplicate file name removal code.
Previously, file name removal was implemented identically in two
places. Now it's captured in one function.
This is important because file name removal is about to get slightly
more complicated with eager tag synchronization and correct removal
atomicity.
Austin Clements [Sat, 11 Jun 2011 16:54:05 +0000 (12:54 -0400)]
new: Cleanup. Put removed/renamed message count in add_files_state_t.
Previously, pointers to these variables were passed around
individually. This was okay when only one function needed them, but
we're about to need them in a few more places.
Austin Clements [Sat, 11 Jun 2011 04:42:58 +0000 (00:42 -0400)]
lib: Wrap notmuch_database_add_message in an atomic section.
Adding a message may involve changes to multiple database documents,
and thus needs to be done in a transaction. This makes add_message
(and, I think, the whole library) atomicity-safe: library callers only
needs to use atomic sections if they needs atomicity across multiple
library calls.
Austin Clements [Sat, 11 Jun 2011 04:19:31 +0000 (00:19 -0400)]
lib: Add an API to find a message by filename.
notmuch_database_find_message_by_filename is mostly stolen from
notmuch_database_remove_message, so this patch also vastly simplfies
the latter using the former.
This API is also useful in its own right and will be used in a later
patch for eager maildir flag synchronization.
Ali Polatel [Sat, 24 Sep 2011 12:54:45 +0000 (15:54 +0300)]
ruby: New exception Notmuch::UnbalancedAtomicError
This exception wraps NOTMUCH_STATUS_UNBALANCED_ATOMIC which was added
with the commit
e59cc0031fbf84f49e32dedb9927f427d2c49309.
Ali Polatel [Sat, 24 Sep 2011 12:43:43 +0000 (15:43 +0300)]
ruby: Wrap notmuch_database_{begin,end}_atomic
Adding ruby wrappers for functions:
- notmuch_database_begin_atomic()
- notmuch_database_end_atomic()
added by
957f1ba3fc1d737887029ff1787fc6bea94de00b
New functions:
Notmuch::Database.begin_atomic()
Notmuch::Database.end_atomic()
Ali Polatel [Sat, 24 Sep 2011 12:25:24 +0000 (15:25 +0300)]
ruby: Rename destroy to destroy!
According to the common Ruby function naming convention, potentially
dangerous functions or functions which operate on the object itself are
suffixed with an exclamation mark. Both of these are true for object
destroying functions.
The following modules are affected:
- Notmuch::Directory
- Notmuch::FileNames
- Notmuch::Query
- Notmuch::Threads
- Notmuch::Thread
- Notmuch::Messages
- Notmuch::Message
- Notmuch::Tags
Austin Clements [Sat, 11 Jun 2011 04:07:54 +0000 (00:07 -0400)]
lib: Remove message document directly after removing the last file name.
Previously, notmuch_database_remove_message would remove the message
file name, sync the change to the message document, re-find the
message document, and then delete it if there were no more file names.
An interruption after sync'ing would result in a file-name-less,
permanently un-removable zombie message that would produce errors and
odd results in searches. We could wrap this in an atomic section, but
it's much simpler to eliminate the round-about approach and just
delete the message document instead of sync'ing it if we removed the
last filename.
Austin Clements [Sun, 6 Feb 2011 09:17:49 +0000 (04:17 -0500)]
lib: Indicate if there are more filenames after removal.
Make _notmuch_message_remove_filename return
NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID if the message has more filenames
and fix callers to handle this.
Austin Clements [Sat, 11 Jun 2011 03:35:06 +0000 (23:35 -0400)]
lib: Add support for nested atomic sections.
notmuch_database_t now keeps a nesting count and we only start a
transaction or commit for the outermost atomic section.
Introduces a new error, NOTMUCH_STATUS_UNBALANCED_ATOMIC.
Austin Clements [Sat, 29 Jan 2011 16:25:24 +0000 (11:25 -0500)]
lib: Add notmuch_database_{begin,end}_atomic.
These operations translate into non-flushed Xapian transactions,
allowing arbitrary groups of database operations to be performed
atomically.
Austin Clements [Tue, 8 Feb 2011 23:24:33 +0000 (18:24 -0500)]
new: Defer updating directory mtimes until the end.
Previously, if notmuch new were interrupted between updating the
directory mtime and handling removals from that directory, a
subsequent notmuch new would not handle those removals until something
else changed in that directory. This defers recording the updated
mtime until after removals are handled to eliminate this problem.
Martin Owens [Fri, 16 Sep 2011 11:19:14 +0000 (13:19 +0200)]
python: Ensure that we pass utf-8 encoded string to libnotmuch
If we use unicode objects, libnotmuch would not cope with null bytes in
the byte array, so we need to make sure they are nicely formatted as
utf-8.
Introduce a helper function _str which does this throughout the code.
Patch slightly modified by Sebastian Spaeth.
Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
Austin Clements [Wed, 9 Feb 2011 01:56:31 +0000 (20:56 -0500)]
new: Don't lose messages on SIGINT.
Previously, message removals were always performed, even after a
SIGINT. As a result, when a message was moved from one folder to
another, a SIGINT between processing the directory the message was
removed from and processing the directory it was added to would result
in notmuch removing that message from the database.
David Bremner [Tue, 13 Sep 2011 12:31:46 +0000 (09:31 -0300)]
test: use test_expect_equal_file in atomicity
The documentation claims this is more robust, and it seems to work
fine to switch to the _file variant.
David Bremner [Sat, 10 Sep 2011 22:02:34 +0000 (19:02 -0300)]
test: Convert atomicity test to use test_subtest_known_broken
This is required because test_expect_equal_failure went away.
Austin Clements [Fri, 28 Jan 2011 18:03:24 +0000 (13:03 -0500)]
test: Test atomicity of notmuch new.
This tests notmuch new's ability to recover from arbitrary stopping
failures. It interrupts notmuch new after every database commit and,
on every resulting database snapshot, re-runs notmuch new to
completion and checks that the final database state is invariant.
Austin Clements [Fri, 10 Jun 2011 19:58:18 +0000 (15:58 -0400)]
lib: Add missing status check in _notmuch_message_remove_filename.
Previously, this function would synchronize the folder list even if
removing the file name failed. Now it returns immediately if removing
the file name fails.
Austin Clements [Thu, 12 May 2011 13:11:36 +0000 (09:11 -0400)]
test: Report test failures from test_expect_*
This makes test_expect_* return non-zero if the test fails, so the
caller can make decisions based on this, such as setting test
prerequisites.
Austin Clements [Thu, 12 May 2011 13:09:06 +0000 (09:09 -0400)]
test: Fix message when skipping test_expect_equal* tests
For these types of tests, the test name is previously recorded in a
variable, not passed to the test function, so pass this variable to
test_skip.
David Bremner [Tue, 13 Sep 2011 01:40:57 +0000 (22:40 -0300)]
test: reset test_subtest_known_broken_ after each success/failure.
This means that test_subtest_known_broken needs to be called before
every known broken subtest, which is no different than what is
documented for the test_begin_subtest case.
The assumption is that every test ends up calling either skipping,
calling test_ok_ or test_failure_ and and the latter in turn delegate
to the known_broken versions in the case where
test_subtest_known_broken_ is set.
Aaron Ecay [Mon, 25 Jul 2011 23:38:58 +0000 (19:38 -0400)]
Add missing call to g_type_init()
The Glib docs state "Prior to any use of the type system, g_type_init() has to
be called".[1] To not do so can lead to segfaults. The g_type system is
currently used by various "filters" that operate on uuencoded text, message
headers, etc.
[1] http://developer.gnome.org/gobject/2.28/gobject-Type-Information.html#g-type-init