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 40932429E25 for ; Sat, 29 Oct 2011 14:11:50 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled 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 TAcStKm1vfnP for ; Sat, 29 Oct 2011 14:11:48 -0700 (PDT) Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id BC206431FB6 for ; Sat, 29 Oct 2011 14:11:47 -0700 (PDT) Received: by faai28 with SMTP id i28so5123476faa.26 for ; Sat, 29 Oct 2011 14:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :organization:user-agent; bh=ocZb+P6BLIrUL+mVAnaXxLSBUCCN4fauBvlgrwcZ8Gk=; b=WPAyF+kXOigU9W3ozqJ+a3rjoqFVm798veE0ypl2o+57OxvSTxLhM1jv1t0iaa/TNm 6kGWQZYwVq2wlJZsjI/BMe3rwifutxjd36oLO6T+uVL9WTBJ0OhFlLC1ERB596SD3hdu yw/NPsVdCF3SgX0RISvpIcNOt83SXzXhXaoIo= Received: by 10.223.15.13 with SMTP id i13mr16257504faa.36.1319922700455; Sat, 29 Oct 2011 14:11:40 -0700 (PDT) Received: from localhost ([88.236.24.25]) by mx.google.com with ESMTPS id k16sm26695430fab.8.2011.10.29.14.11.38 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 29 Oct 2011 14:11:39 -0700 (PDT) Date: Sun, 30 Oct 2011 00:11:35 +0300 From: Ali Polatel To: David Bremner Subject: Re: [PATCH] contrib/nmbug: new script for sharing tags with prefix notmuch:: Message-ID: <20111029211134.GB4228@hayalet> Mail-Followup-To: David Bremner , notmuch@notmuchmail.org, David Bremner References: <1319857491-12298-5-git-send-email-david@tethera.net> <1319906707-10141-1-git-send-email-david@tethera.net> <1319906707-10141-2-git-send-email-david@tethera.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0eh6TmSyL6TZE2Uz" Content-Disposition: inline In-Reply-To: <1319906707-10141-2-git-send-email-david@tethera.net> Organization: Pink Floyd User-Agent: Mutt/1.5.21 (2010-09-15) Cc: notmuch@notmuchmail.org, David Bremner 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: Sat, 29 Oct 2011 21:11:50 -0000 --0eh6TmSyL6TZE2Uz Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Oct 29, 2011 at 01:45:07PM -0300, David Bremner wrote: >From: David Bremner > >In this initial version, we take care of only the base import and >export of the appropriate tags in line oriented format amenable to >easy merging. > >The current plan to use git to share tags and resolve conflicts. >--- > contrib/nmbug | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++ > 1 files changed, 69 insertions(+), 0 deletions(-) > create mode 100755 contrib/nmbug > >diff --git a/contrib/nmbug b/contrib/nmbug >new file mode 100755 >index 0000000..e9d1b14 >--- /dev/null >+++ b/contrib/nmbug >@@ -0,0 +1,69 @@ >+#!/bin/bash ^^ I'd make that: #!/usr/bin/env bash for systems where bash is not the default shell. >+# Copyright (c) 2011 David Bremner >+# License: same as notmuch >+ >+NMHOME=3D${HOME}/.nmbug >+ >+NMTAGS=3D($(notmuch search --output=3Dtags "*"|grep "^notmuch::")) >+ >+function dump() { >+ notmuch dump -- $(printf " tag:%s" ${NMTAGS[*]}) |\ >+ while read -r msgid rest >+ do >+ outfile=3D$NMHOME/tags/$(echo $msgid | sha1sum - | cut -f1 -d' ') >+ echo $outfile >+ printf "msg-id: %s\n" $msgid > $outfile >+ tmp=3D${rest#\(} >+ read -r -a tags <<<${tmp%\)}; >+ for tag in "${tags[@]}"; do >+ case $tag in >+ notmuch::*) >+ echo "tag: $tag" >> $outfile >+ ;; >+ *) >+ # nothing >+ esac >+ done >+ done >+ >+} >+ >+function cat_file() { >+ tags=3D"" >+ id=3D"" >+ cat $1 |\ >+ while read -r what data >+ do >+ case $what in >+ msg-id:) >+ printf "%s (" $data >+ ;; >+ tag:) >+ printf "%s " $data >+ ;; >+ *) >+ echo "Syntax error $what" >+ exit 1 >+ esac >+ done >+ echo ")" >+} >+ >+function restore() { >+ find $NMHOME/tags -type f |\ >+ while read -r filename >+ do >+ cat_file $filename >+ done | notmuch restore --match=3Dnotmuch:: >+} >+case $1 in >+ dump) >+ dump >+ ;; >+ restore) >+ restore >+ ;; >+ *) >+ echo unknown command $1; >+esac >+ >--=20 >1.7.6.3 > >_______________________________________________ >notmuch mailing list >notmuch@notmuchmail.org >http://notmuchmail.org/mailman/listinfo/notmuch --0eh6TmSyL6TZE2Uz Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iEYEARECAAYFAk6sbAYACgkQQU4yORhF8iDaqQCePu8QY1DNdjLoV0hkWDLqHGha 8LIAn0Oaj3rCct2LtwxBx9Jaf7ilfSq0 =DgyJ -----END PGP SIGNATURE----- --0eh6TmSyL6TZE2Uz--