Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 98CC5431FBC for ; Mon, 18 Jan 2010 07:12:35 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.001 X-Spam-Level: X-Spam-Status: No, score=0.001 tagged_above=-999 required=5 tests=[BAYES_50=0.001] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OYaUPWnizHK4 for ; Mon, 18 Jan 2010 07:12:34 -0800 (PST) Received: from mout.perfora.net (mout.perfora.net [74.208.4.194]) by olra.theworths.org (Postfix) with ESMTP id CC541431FAE for ; Mon, 18 Jan 2010 07:12:34 -0800 (PST) Received: from homiemail-a21.g.dreamhost.com (caiajhbdcbbj.dreamhost.com [208.97.132.119]) by mx.perfora.net (node=mxus2) with ESMTP (Nemesis) id 0MStEz-1NNAU30eNp-00RpIY for notmuch@notmuchmail.org; Mon, 18 Jan 2010 10:12:34 -0500 Received: from sspaeth.de (mtec-hg-docking-2-dhcp-062.ethz.ch [82.130.121.62]) by homiemail-a21.g.dreamhost.com (Postfix) with ESMTPA id C1F9630006C for ; Mon, 18 Jan 2010 07:12:31 -0800 (PST) Received: by sspaeth.de (sSMTP sendmail emulation); Mon, 18 Jan 2010 16:12:28 +0100 From: "Sebastian Spaeth" To: notmuch@notmuchmail.org Date: Mon, 18 Jan 2010 16:12:28 +0100 Message-ID: <87pr57jvkz.fsf@SSpaeth.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [notmuch] Introducing notmuchsync X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jan 2010 15:12:35 -0000 Dear list, I really want to sync my maildir flags/folders with notmuch tags and as I haven't seen a script to do that, I've written (the beginnings of?) one. It is probably pre-alpha but I am a fan of release early, release often and if someone finds it useful to build upon, it was already worth it. I put the code here: http://github.com/spaetz/notmuchsync What does it do? ================ - Synchronizes the "S" flag with the "unread" tag (1-way). The synchronization direction is decided by using either --sync (change maildir flags according to notmuch) or --revsync (change notmuch tags according to maildir). By default it always checks the mails from the previous 30 days (but can also do --all mails if you have plenty of RAM and time). - Deletes all mail files that have the "delete" tag - Quiet/normal/verbose logging Workflow ======== 1a) start out with notmuchsync -r in order to initialize the notmuch tag database based on maildir 'S' flags. This is probably what everyone but Carl Worth wants. :-) If the "--all" command works for you, even better, but I doubt it as it would store all your mails in RAM. 1b) start out with not What needs improvment ===================== - It's a python script in one file. The architecture might need some cleanup. Documentation needs work too. - It temporarily slurps in all your mails from the last 30 days into RAM. I am waiting for "notmuchs show blah --output filename --output tags" to improve that :). Generally the parsing of the output of "notmuch show" is a bit hackyish with regexps at the moment. - Support parsing "chunks" of "notmuch show" output or do several runs for -all, using monthly intervals to make --all work. - Support for the "T" (delete), "F" (flag), "D" (draft) tags/flags. Should be pretty easy to add. - Support syncing of the "inbox" tag if the mail is in a dir different than INBOX. No clue yet how to do. Perhaps if a maildir name corresponds to a notmuch tag name, we move the mail there? - It seems to work for me, but is untested in environments with spaces in paths and windows machines. - the --doeverything command that prunes and syncs in one go What else ========= - It is GPL v2.1+ - Please improve and/or fork this thing. - If you don't like it, just ignore it. Thanks for your understanding. ----------------------------------------------------------------------- Usage: -p --prune Prune deleted mails -s --sync Sync from notmuch tags to maildir flags. By default it will only look for mails from the last 30 days. Use --all to look at earlier mails. Beware, if timestamps are more than 30 days in the future, we won't handle it. -r --revsync Sync tags from maildir to notmuch. See also -s. Options: -d Really verbose debug oputput. -q Log only errors. --dryrun Do not really modify notmuch db or mail files Works together with -p -s -r ---------------------------------------------------------------------- Let me know what you like or don't. If you want github contributor right, I am willing to hand out access quite liberal. And as always: patches welcome. :-) spaetz