--- /dev/null
+Return-Path: <bremner@tethera.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 31611429E25\r
+ for <notmuch@notmuchmail.org>; Sat, 29 Oct 2011 10:27:46 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id G4lj7XMJQsFO for <notmuch@notmuchmail.org>;\r
+ Sat, 29 Oct 2011 10:27:45 -0700 (PDT)\r
+Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 851A0431FB6\r
+ for <notmuch@notmuchmail.org>; Sat, 29 Oct 2011 10:27:45 -0700 (PDT)\r
+Received: from zancas.localnet\r
+ (fctnnbsc36w-156034064058.pppoe-dynamic.High-Speed.nb.bellaliant.net\r
+ [156.34.64.58]) (authenticated bits=0)\r
+ by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id p9THRfJ6026102\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO);\r
+ Sat, 29 Oct 2011 14:27:42 -0300\r
+Received: from bremner by zancas.localnet with local (Exim 4.76)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1RKCh3-0003fA-8l; Sat, 29 Oct 2011 14:27:41 -0300\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2] contrib/nmbug: new script for sharing tags with prefix\r
+ notmuch::\r
+Date: Sat, 29 Oct 2011 14:27:33 -0300\r
+Message-Id: <1319909253-14045-1-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 1.7.6.3\r
+In-Reply-To: <1319906707-10141-1-git-send-email-david@tethera.net>\r
+References: <1319906707-10141-1-git-send-email-david@tethera.net>\r
+Cc: David Bremner <bremner@debian.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 29 Oct 2011 17:27:46 -0000\r
+\r
+From: David Bremner <bremner@debian.org>\r
+\r
+In this initial version, we take care of import and export of the\r
+appropriate tags in line oriented format amenable to easy merging.\r
+\r
+We also provide (not very robust/clever) commands commit/push/pull\r
+to deal with a git repo that as already been set up.\r
+---\r
+\r
+fixed silly debugging output.\r
+add some convenience commands.\r
+\r
+ contrib/nmbug | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r
+ 1 files changed, 77 insertions(+), 0 deletions(-)\r
+ create mode 100755 contrib/nmbug\r
+\r
+diff --git a/contrib/nmbug b/contrib/nmbug\r
+new file mode 100755\r
+index 0000000..a449d60\r
+--- /dev/null\r
++++ b/contrib/nmbug\r
+@@ -0,0 +1,77 @@\r
++#!/bin/bash\r
++# Copyright (c) 2011 David Bremner\r
++# License: same as notmuch\r
++\r
++NMHOME=${HOME}/.nmbug\r
++\r
++NMTAGS=($(notmuch search --output=tags "*"|grep "^notmuch::"))\r
++\r
++function dump() {\r
++ notmuch dump -- $(printf " tag:%s" ${NMTAGS[*]}) |\\r
++ while read -r msgid rest \r
++ do\r
++ outfile=$NMHOME/tags/$(echo $msgid | sha1sum - | cut -f1 -d' ')\r
++ printf "msg-id: %s\n" $msgid > $outfile\r
++ tmp=${rest#\(}\r
++ read -r -a tags <<<${tmp%\)};\r
++ for tag in "${tags[@]}"; do\r
++ case $tag in\r
++ notmuch::*)\r
++ echo "tag: $tag" >> $outfile\r
++ ;;\r
++ *)\r
++ # nothing\r
++ esac\r
++ done\r
++ done\r
++ \r
++}\r
++\r
++function cat_file() {\r
++ tags=""\r
++ id=""\r
++ cat $1 |\\r
++ while read -r what data \r
++ do\r
++ case $what in\r
++ msg-id:)\r
++ printf "%s (" $data \r
++ ;;\r
++ tag:)\r
++ printf "%s " $data\r
++ ;;\r
++ *)\r
++ echo "Syntax error $what"\r
++ exit 1\r
++ esac\r
++ done\r
++ echo ")"\r
++}\r
++\r
++function restore() {\r
++ find $NMHOME/tags -type f |\\r
++ while read -r filename\r
++ do\r
++ cat_file $filename\r
++ done | notmuch restore --match=notmuch::\r
++}\r
++case $1 in\r
++ dump)\r
++ dump\r
++ ;;\r
++ restore)\r
++ restore\r
++ ;;\r
++ commit)\r
++ (cd $NMHOME && git add tags && git commit)\r
++ ;;\r
++ push)\r
++ (cd $NMHOME && git push)\r
++ ;;\r
++ pull)\r
++ (cd $NMHOME && git pull)\r
++ ;;\r
++ *)\r
++ echo unknown command $1;\r
++esac\r
++ \r
+-- \r
+1.7.6.3\r
+\r