unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Ali Polatel <polatel@gmail.com>
To: David Bremner <david@tethera.net>
Cc: notmuch@notmuchmail.org, David Bremner <bremner@debian.org>
Subject: Re: [PATCH] contrib/nmbug: new script for sharing tags with prefix notmuch::
Date: Sun, 30 Oct 2011 00:11:35 +0300	[thread overview]
Message-ID: <20111029211134.GB4228@hayalet> (raw)
In-Reply-To: <1319906707-10141-2-git-send-email-david@tethera.net>

[-- Attachment #1: Type: text/plain, Size: 2238 bytes --]

On Sat, Oct 29, 2011 at 01:45:07PM -0300, David Bremner wrote:
>From: David Bremner <bremner@debian.org>
>
>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=${HOME}/.nmbug
>+
>+NMTAGS=($(notmuch search --output=tags "*"|grep "^notmuch::"))
>+
>+function dump() {
>+    notmuch dump -- $(printf  " tag:%s" ${NMTAGS[*]}) |\
>+    while read  -r msgid rest
>+    do
>+	outfile=$NMHOME/tags/$(echo $msgid | sha1sum - | cut -f1 -d' ')
>+	echo $outfile
>+	printf "msg-id: %s\n" $msgid > $outfile
>+	tmp=${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=""
>+    id=""
>+    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=notmuch::
>+}
>+case $1 in
>+    dump)
>+	dump
>+	;;
>+    restore)
>+	restore
>+	;;
>+    *)
>+	echo unknown command $1;
>+esac
>+
>-- 
>1.7.6.3
>
>_______________________________________________
>notmuch mailing list
>notmuch@notmuchmail.org
>http://notmuchmail.org/mailman/listinfo/notmuch

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2011-10-29 21:11 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-23 15:18 [PATCH] xutil.c: remove duplicate copies, create new library libutil.a to contain xutil David Bremner
2011-10-23 21:51 ` [PATCH] xregcomp: don't consider every regex compilation failure an internal error David Bremner
2011-10-29  3:04   ` David Bremner
2011-10-29  3:04     ` [PATCH 1/4] notmuch-restore: add tests for new --match command line argument David Bremner
2011-10-29  3:04     ` [PATCH 2/4] notmuch-restore: implement argument parsing for --match David Bremner
2011-10-29  3:04     ` [PATCH 3/4] test/dump-restore: add tests for notmuch restore --match David Bremner
2011-10-29  3:04     ` [PATCH 4/4] notmuch-restore: implement --match functionality David Bremner
2011-10-29 16:45       ` Experimental Tag Sharing David Bremner
2011-10-29 16:45         ` [PATCH] contrib/nmbug: new script for sharing tags with prefix notmuch:: David Bremner
2011-10-29 21:11           ` Ali Polatel [this message]
2011-10-29 22:12             ` David Bremner
2011-10-30  0:21               ` Ali Polatel
2011-11-07  0:59           ` [PATCH] contrib/nmbug: new script for sharing tags with a given prefix David Bremner
2011-11-07 12:58             ` Tomi Ollila
2011-11-11 15:08             ` [PATCH v3] " David Bremner
2011-11-11 23:26               ` Jameson Graef Rollins
2011-11-11 23:55                 ` David Bremner
2011-11-12  2:43                   ` Jameson Graef Rollins
2011-11-12  5:52                     ` David Bremner
2011-11-13  1:39               ` David Bremner
2011-10-29 17:27         ` [PATCH v2] contrib/nmbug: new script for sharing tags with prefix notmuch:: David Bremner
2011-10-30  0:44         ` Experimental Tag Sharing Jameson Graef Rollins
2011-10-30  2:18           ` David Bremner
2011-10-29 20:55       ` [PATCH] docs: man, online help, and NEWS updated for notmuch restore --match David Bremner
2011-10-31 19:01         ` [PATCH] Fix formatting for restore and dump help documentation Jameson Graef Rollins
2011-11-01  0:19           ` David Bremner
2011-10-29 18:52 ` [PATCH] xutil.c: remove duplicate copies, create new library libutil.a to contain xutil David Bremner
2011-10-31  0:04 ` Austin Clements
2011-10-31  0:09 ` Jameson Graef Rollins
2011-10-31  2:28   ` David Bremner
2011-10-31  9:20 ` Jani Nikula
2011-10-31 10:51   ` David Bremner
2011-10-31 18:50   ` Jameson Graef Rollins
2011-10-31 19:19     ` Jani Nikula
2011-10-31 19:20       ` Jameson Graef Rollins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111029211134.GB4228@hayalet \
    --to=polatel@gmail.com \
    --cc=bremner@debian.org \
    --cc=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).