Commit graph

2380 commits

Author SHA1 Message Date
Sebastian Spaeth
0241a68e9e 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>
2011-09-28 18:31:49 +02:00
Sebastian Spaeth
2c76279cda python: Add database_find_message_by_filename bindings
Add it :-)

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-09-28 18:31:36 +02:00
David Bremner
c83e3ee259 NEWS: add item for python bindings.
Just the one unicode related change this release.
2011-09-26 20:27:42 -03:00
David Bremner
b8cbec57af NEWS: add item for Ruby bindings.
This is based on a quick scan of git log.
2011-09-26 20:23:55 -03:00
David Bremner
a74cd4367e NEWS: start release notes for 0.9
Thanks to Austin Clements for providing these notes, and the patches
they describe.
2011-09-26 20:18:55 -03:00
David Bremner
45669fd647 debian: add brief summary of changes since 0.8 2011-09-25 11:27:03 -03:00
David Bremner
a70efbc845 debian: build-depend on gdb
This is needed to enable the atomicity tests at build time.
2011-09-25 11:16:06 -03:00
David Bremner
2697f623ae test/atomicity: redirect output from "which"
Without redirection, this produced some slightly confusing output in
case gdb was present.
2011-09-25 09:12:48 -03:00
David Bremner
dd7cb35c82 debian: close bug 642240
The bug was really closed by the commit that updated the dependency,
of course.
2011-09-24 23:15:01 -03:00
David Bremner
c468f3703e 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.
2011-09-24 22:45:33 -03:00
David Bremner
0ce713ae02 lib: bump library minor version because of new symbols.
This bump is because of the new symbols introduced by the atomicity
patches.
2011-09-24 20:26:42 -03:00
David Bremner
b00408e573 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.
2011-09-24 20:26:42 -03:00
David Bremner
78d39a0908 version: bump to 0.9~rc1
This version number change should not be taken as definitive, rather
refer to the signed tag.
2011-09-24 20:00:29 -03:00
David Bremner
a37a5404e2 debian: changlog stanza for release candidate 2011-09-24 20:00:29 -03:00
David Bremner
9d5b810ab6 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.
2011-09-24 20:00:29 -03:00
Austin Clements
35f4a0f18b 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.
2011-09-24 20:00:29 -03:00
Austin Clements
bff30540d8 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.
2011-09-24 20:00:29 -03:00
Austin Clements
8305f0aac7 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.
2011-09-24 20:00:28 -03:00
Austin Clements
191c4ae693 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.
2011-09-24 20:00:28 -03:00
Austin Clements
1353dbe864 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.
2011-09-24 20:00:28 -03:00
Austin Clements
51c3c0b2d2 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.
2011-09-24 20:00:28 -03:00
Austin Clements
7a8046ced8 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.
2011-09-24 20:00:28 -03:00
Ali Polatel
59d2457bcc ruby: New exception Notmuch::UnbalancedAtomicError
This exception wraps NOTMUCH_STATUS_UNBALANCED_ATOMIC which was added
with the commit e59cc0031f.
2011-09-24 15:54:45 +03:00
Ali Polatel
bbb41081d7 ruby: Wrap notmuch_database_{begin,end}_atomic
Adding ruby wrappers for functions:
- notmuch_database_begin_atomic()
- notmuch_database_end_atomic()
added by 957f1ba3fc

New functions:
Notmuch::Database.begin_atomic()
Notmuch::Database.end_atomic()
2011-09-24 15:43:43 +03:00
Ali Polatel
a08aa32b44 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
2011-09-24 15:25:24 +03:00
Austin Clements
bfe4555325 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.
2011-09-23 21:50:39 -04:00
Austin Clements
e4379c43e2 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.
2011-09-23 21:50:39 -04:00
Austin Clements
e59cc0031f 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.
2011-09-23 21:50:38 -04:00
Austin Clements
957f1ba3fc 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.
2011-09-23 21:50:38 -04:00
Austin Clements
fcd433709e 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.
2011-09-23 21:50:38 -04:00
Martin Owens
8e7a108363 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>
2011-09-16 13:19:14 +02:00
Austin Clements
bdaee77e1b 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.
2011-09-13 22:00:15 -03:00
David Bremner
73ed66a501 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.
2011-09-13 09:31:46 -03:00
David Bremner
05a522c5fa test: Convert atomicity test to use test_subtest_known_broken
This is required because test_expect_equal_failure went away.
2011-09-13 09:28:08 -03:00
Austin Clements
9ade8160a6 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.
2011-09-12 23:36:00 -03:00
Austin Clements
62445dd023 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.
2011-09-12 23:36:00 -03:00
Austin Clements
003e718020 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.
2011-09-12 23:36:00 -03:00
Austin Clements
5ae1b9c328 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.
2011-09-12 23:35:59 -03:00
David Bremner
22af786838 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.
2011-09-12 23:35:21 -03:00
Aaron Ecay
fa52a0d094 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
2011-09-10 15:19:51 -03:00
David Bremner
0a7aa617d5 test: mark multipart rfc822 part test as broken
Using the new test_subtest_known_broken support thanks to Dmitry
Kurochkin.  This makes the output less scary until we can fix the
underlying problems.
2011-09-10 15:00:17 -03:00
David Bremner
3ee541ab31 test: remove documentation for test_expect_equal_failure.
The actual function was deleted in commit 4cc67276
2011-09-10 14:54:56 -03:00
Dmitry Kurochkin
c6a3a768fe test: add emacs test for hiding a message following an HTML part
Human-friendly scenario:

* open a thread where a message which ends with an HTML part is
  followed by another message

* make the first message visible

* goto the beginning of the second message (first line, first colon)

* hit "RET"

Result: nothing happens except for "No URL at point" message

Expected result: the second message is shown/hidden

The root cause is that the HTML part has `keymap' text property set.
In particular, "RET" is bound to visit a URL at point.  The problem is
that `keymap' property affects the next character following the region
it is set to (see elisp manual [1]).  Hence, the first character of
the next message has a keymap inherited from the HTML part.

[1] http://www.gnu.org/software/emacs/elisp/html_node/Special-Properties.html
2011-09-10 10:13:40 -03:00
Dmitry Kurochkin
4cc6727688 test: improve known broken tests support
There is existing support for broken tests.  But it is not convenient
to use.  The primary issue is that we have to maintain a set of
test_expect_*_failure functions which are equivalent to the normal
test_expect_* counterparts except for what functions are called for
result reporting.  The patch adds test_subtest_known_broken function
which marks a subset as broken, making the normal test_expect_*
functions behave as test_expect_*_failure.  All test_expect_*_failure
functions are removed.  Test_known_broken_failure_ is changed to
format details the same way as test_failure_ does.

Another benefit of this change is that the diff when a broken test is
fixed would be small and nice.

Documentation is updated accordingly.
2011-09-10 10:13:27 -03:00
Dmitry Kurochkin
0db3a4d5be test: update documentation for test_emacs in test/README
Update test_emacs documentation in test/README according to the latest
changes in emacs tests.  Move the note regarding setting variables
from test/emacs to test/README.
2011-09-10 10:12:03 -03:00
David Bremner
c35ac0bdbd Merge branch 'release' 2011-09-10 10:11:25 -03:00
David Bremner
b824877c43 update date in NEWS to better approximate real release date for 0.8 2011-09-10 09:00:40 -03:00
David Bremner
9ec96edb10 debian: update changelog for 0.8 2011-09-10 08:57:43 -03:00
David Bremner
24fc8f97e8 update versions for release 0.8
See commit 6979b65 for more discussion.
2011-09-10 08:55:33 -03:00
David Bremner
f4cd15f78a NEWS: add blurb for python bindings changes 2011-09-10 08:52:22 -03:00