[notmuch] Mailstore abstraction & maildir synchronization

2010-03-27 Thread Michal Sojka
On Sat, 27 Mar 2010, Michal Sojka wrote:
> On Fri, 26 Mar 2010, Michal Sojka wrote:
> > On Wed, 24 Mar 2010, Stewart Smith wrote:
> > > On Thu, 18 Mar 2010 16:39:36 +0100, Michal Sojka  
> > > wrote:
> > > > - Only file-based storage is suported. Notmuch access the files
> > > >   directly, and not via the mailstore interface.
> > > 
> > > It'll be great when this is fixed... should be trivial to add a git
> > > backend then.
> > 
> > Yes, it seems to be quite trivial. I'll probably look at this tomorrow.
> 
> Here it is. It was not so trivial, because it was needed to change
> absolute paths to relative ones at several places.

I forgot to mention that this is also available in
git://rtime.felk.cvut.cz/notmuch.git branch mailstore-abstraction-v3 and
can be viewed online at http://rtime.felk.cvut.cz/gitweb/notmuch.git.

Michal


[notmuch] Mailstore abstraction & maildir synchronization

2010-03-27 Thread Michal Sojka
On Fri, 26 Mar 2010, Michal Sojka wrote:
> On Wed, 24 Mar 2010, Stewart Smith wrote:
> > On Thu, 18 Mar 2010 16:39:36 +0100, Michal Sojka  
> > wrote:
> > > - Only file-based storage is suported. Notmuch access the files
> > >   directly, and not via the mailstore interface.
> > 
> > It'll be great when this is fixed... should be trivial to add a git
> > backend then.
> 
> Yes, it seems to be quite trivial. I'll probably look at this tomorrow.

Here it is. It was not so trivial, because it was needed to change
absolute paths to relative ones at several places.

So the changes since v2 are:

- "Tests for maildir-based mailstore": removed absolute paths as found
  on my computer.
- Added "Access messages through mail store interface"
- Added "Add 'cat' subcommand"

Michal Sojka (6):
  Mailstore abstraction interface
  Conversion to mailstore abstraction
  Add maildir-based mailstore
  Tests for maildir-based mailstore
  Access messages through mail store interface
  Add 'cat' subcommand

 emacs/notmuch.el|8 +-
 lib/Makefile.local  |2 +
 lib/database-private.h  |1 +
 lib/database.cc |   36 ++-
 lib/index.cc|8 +-
 lib/mailstore-files.c   |  831 +++
 lib/mailstore-private.h |   59 
 lib/mailstore.c |   78 +
 lib/message-file.c  |8 +-
 lib/message.cc  |   85 +-
 lib/notmuch-private.h   |   10 +-
 lib/notmuch.h   |   98 ++-
 lib/sha1.c  |6 +-
 notmuch-client.h|   12 +-
 notmuch-config.c|   34 ++
 notmuch-count.c |3 +-
 notmuch-dump.c  |3 +-
 notmuch-new.c   |  646 -
 notmuch-reply.c |   13 +-
 notmuch-restore.c   |3 +-
 notmuch-search-tags.c   |3 +-
 notmuch-search.c|3 +-
 notmuch-show.c  |   79 +-
 notmuch-tag.c   |3 +-
 notmuch.c   |4 +
 show-message.c  |   14 +-
 test/t0006-maildir.sh   |  208 
 test/test-lib.sh|7 +-
 28 files changed, 1611 insertions(+), 654 deletions(-)
 create mode 100644 lib/mailstore-files.c
 create mode 100644 lib/mailstore-private.h
 create mode 100644 lib/mailstore.c
 create mode 100755 test/t0006-maildir.sh






[notmuch] Mailstore abstraction & maildir synchronization

2010-03-27 Thread Michal Sojka
On Wed, 24 Mar 2010, Stewart Smith wrote:
> On Thu, 18 Mar 2010 16:39:36 +0100, Michal Sojka  
> wrote:
> > - Only file-based storage is suported. Notmuch access the files
> >   directly, and not via the mailstore interface.
> 
> It'll be great when this is fixed... should be trivial to add a git
> backend then.

Yes, it seems to be quite trivial. I'll probably look at this tomorrow.
> 
> (i have in no way been looking at tags in git though... doesn't really
> interest me and git aint a database)

My aim is only to store tags in git for the purpose of synchronization.
I'm not interested in searching by tags. The idea is that for every
message there will be an additional blob containging tags - one tag per
line.

> 
> > - (maildir) Viewing/storing of attachments of unread messages doesn't
> >   work. The reason is that when you view the message it its unread tag
> >   is removed which leads to rename of the file, but Emacs still uses
> >   the original name to access the attachment.
> 
> What about migrating from a maildir that's turned into notmuch back to
> this maildir backend? What will be authoritive: maildir or notmuch
> database?

Maildir is authoritative, but only for tags corresponding to maildir
flags. Other tags are never touched by this code. See also the updated
commit message in "[PATCH v2 3/4] Add maildir-based mailstore".

If you want to sync your maildirs with the databse the following should
work (not tested):

notmuch dump > dump
cat <> ~/.notmuch-config
[mailstore]
type=maildir
EOF
notmuch restore dump


--Michal



Re: [notmuch] Mailstore abstraction maildir synchronization

2010-03-27 Thread Michal Sojka
On Sat, 27 Mar 2010, Michal Sojka wrote:
 On Fri, 26 Mar 2010, Michal Sojka wrote:
  On Wed, 24 Mar 2010, Stewart Smith wrote:
   On Thu, 18 Mar 2010 16:39:36 +0100, Michal Sojka sojk...@fel.cvut.cz 
   wrote:
- Only file-based storage is suported. Notmuch access the files
  directly, and not via the mailstore interface.
   
   It'll be great when this is fixed... should be trivial to add a git
   backend then.
  
  Yes, it seems to be quite trivial. I'll probably look at this tomorrow.
 
 Here it is. It was not so trivial, because it was needed to change
 absolute paths to relative ones at several places.

I forgot to mention that this is also available in
git://rtime.felk.cvut.cz/notmuch.git branch mailstore-abstraction-v3 and
can be viewed online at http://rtime.felk.cvut.cz/gitweb/notmuch.git.

Michal
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] Mailstore abstraction & maildir synchronization

2010-03-24 Thread Stewart Smith
On Thu, 18 Mar 2010 16:39:36 +0100, Michal Sojka  wrote:
> - Only file-based storage is suported. Notmuch access the files
>   directly, and not via the mailstore interface.

It'll be great when this is fixed... should be trivial to add a git
backend then.

(i have in no way been looking at tags in git though... doesn't really
interest me and git aint a database)

> - (maildir) Viewing/storing of attachments of unread messages doesn't
>   work. The reason is that when you view the message it its unread tag
>   is removed which leads to rename of the file, but Emacs still uses
>   the original name to access the attachment.

What about migrating from a maildir that's turned into notmuch back to
this maildir backend? What will be authoritive: maildir or notmuch database?
-- 
Stewart Smith


Re: [notmuch] Mailstore abstraction maildir synchronization

2010-03-23 Thread Stewart Smith
On Thu, 18 Mar 2010 16:39:36 +0100, Michal Sojka sojk...@fel.cvut.cz wrote:
 - Only file-based storage is suported. Notmuch access the files
   directly, and not via the mailstore interface.

It'll be great when this is fixed... should be trivial to add a git
backend then.

(i have in no way been looking at tags in git though... doesn't really
interest me and git aint a database)

 - (maildir) Viewing/storing of attachments of unread messages doesn't
   work. The reason is that when you view the message it its unread tag
   is removed which leads to rename of the file, but Emacs still uses
   the original name to access the attachment.

What about migrating from a maildir that's turned into notmuch back to
this maildir backend? What will be authoritive: maildir or notmuch database?
-- 
Stewart Smith
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] Mailstore abstraction & maildir synchronization

2010-03-18 Thread Michal Sojka
Hi all,

I've finally found some time to implement the mailstore abstraction
was initially described in id:87ljecmnbd.fsf at steelpick.localdomain and
id:87eijqlz54.fsf at steelpick.localdomain.

The idea is to allow notmuch operate on different types of mail
storage (e.g. mail in git repositories) and to store the tags in the
storage together with mails. The aim is the ability to synchronize
mails and tags between computers. The following patch series is the
first version which I'm able to use on daily basis so I'd like to get
some feedback.

In the current form, the patch series implements two mail stores:
1. plain files (compatible with the current notmuch)
2. maildir (synchronizes certain tags with maildir flags)

The series passes the test suite. For the maildir store, there are
additional tests, but you need need the modularized testsuite (taken
from git). The whole patch series is also available from
git://rtime.felk.cvut.cz/notmuch.git mailstore-abstraction-v1 (this
branch wont be rebased).

Known bugs and limitations:

- Only file-based storage is suported. Notmuch access the files
  directly, and not via the mailstore interface.

- (maildir) Viewing/storing of attachments of unread messages doesn't
  work. The reason is that when you view the message it its unread tag
  is removed which leads to rename of the file, but Emacs still uses
  the original name to access the attachment.

  Workaround: close the message and open it again.

Maildir howto:

1. Backup you emails
2. Apply the patches (at least 1-3)
3. Configure notmuch to use maildir store
cat > ~/.notmuch-config <

[notmuch] Mailstore abstraction maildir synchronization

2010-03-18 Thread Michal Sojka
Hi all,

I've finally found some time to implement the mailstore abstraction
was initially described in id:87ljecmnbd@steelpick.localdomain and
id:87eijqlz54@steelpick.localdomain.

The idea is to allow notmuch operate on different types of mail
storage (e.g. mail in git repositories) and to store the tags in the
storage together with mails. The aim is the ability to synchronize
mails and tags between computers. The following patch series is the
first version which I'm able to use on daily basis so I'd like to get
some feedback.

In the current form, the patch series implements two mail stores:
1. plain files (compatible with the current notmuch)
2. maildir (synchronizes certain tags with maildir flags)

The series passes the test suite. For the maildir store, there are
additional tests, but you need need the modularized testsuite (taken
from git). The whole patch series is also available from
git://rtime.felk.cvut.cz/notmuch.git mailstore-abstraction-v1 (this
branch wont be rebased).

Known bugs and limitations:

- Only file-based storage is suported. Notmuch access the files
  directly, and not via the mailstore interface.

- (maildir) Viewing/storing of attachments of unread messages doesn't
  work. The reason is that when you view the message it its unread tag
  is removed which leads to rename of the file, but Emacs still uses
  the original name to access the attachment.

  Workaround: close the message and open it again.

Maildir howto:

1. Backup you emails
2. Apply the patches (at least 1-3)
3. Configure notmuch to use maildir store
cat  ~/.notmuch-config EOF
[mailstore]
type=maildir
EOF
4. Enjoy

Advantages for me:

- Whenever I read a message my mobile phone gets that information
  since I run offlineimap periodically on background.
- My mailsync script (notmuch new + tagging) is much faster because it
  does not call offlineimap and notmuchsync (two times). I call it
  manually, because I want to decide when new mail should appear.

Cheers,
-Michal
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch