Re: Gmane vs. Mail Archive notmuch-report config

2018-02-15 Thread W. Trevor King
On Thu, Feb 15, 2018 at 03:02:58PM -0500, Daniel Kahn Gillmor wrote:
> On Thu 2018-02-15 10:56:29 -0800, W. Trevor King wrote:
> > On Thu, Feb 15, 2018 at 11:01:40AM -0500, Daniel Kahn Gillmor wrote:
> >> -  "message-url": "http://mid.gmane.org/{message-id};
> >> +  "message-url": "https://mid.gmane.org/{message-id};
> >
> > I was wondering whether it made sense to change these to something
> > else with Gmane down.  But it appears that Gmane is back up, possibly
> > since ~2016-09-14 [1]).  The current notmuch-report output [2] is
> > linking to the Mail Archive though (e.g. [3]) and not to Gmane
> > (e.g. [4]).  Perhaps we want to revert 2d6500a0 (change mid link to
> > mail-archive.com, 2017-03-19) and go back to Gmane?  Or use one of the
> > other notmuch-based archives that has been floating around on the list
> > recently?
> 
> while i'm game to reconsider this (and clearly my work on
> https://nmbug.notmuchmail.org/btsmail is intended for a future
> replacement), i don't want to block the proposed patch from landing.
> what did you think of the rest of the patch? :)

No opinions on the rest of the patch ;).  I'm generally in favor of
HTTPS, but didn't check all the links and such.  I just thought “why
bother updating these if Gmane is down?” and then found out that it
was back up and that our notmuch-report wasn't using it.  This “Gmane
vs. Mail Archive notmuch-report config” sub-thread is just about that,
and not part of patch review.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Gmane vs. Mail Archive notmuch-report config (was: [PATCH] move more http -> https)

2018-02-15 Thread W. Trevor King
On Thu, Feb 15, 2018 at 11:01:40AM -0500, Daniel Kahn Gillmor wrote:
> -  "message-url": "http://mid.gmane.org/{message-id};
> +  "message-url": "https://mid.gmane.org/{message-id};

I was wondering whether it made sense to change these to something
else with Gmane down.  But it appears that Gmane is back up, possibly
since ~2016-09-14 [1]).  The current notmuch-report output [2] is
linking to the Mail Archive though (e.g. [3]) and not to Gmane
(e.g. [4]).  Perhaps we want to revert 2d6500a0 (change mid link to
mail-archive.com, 2017-03-19) and go back to Gmane?  Or use one of the
other notmuch-based archives that has been floating around on the list
recently?

Cheers,
Trevor

[1]: http://home.gmane.org/2016/09/14/anatomy-gmane-v2/
[2]: https://nmbug.notmuchmail.org/status/
[3]: http://mid.mail-archive.com/87zk4eqech.fsf%40inf-8657.int-evry.fr
[4]: https://mid.gmane.org/87zk4eqech.fsf%40inf-8657.int-evry.fr

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] nmbug: explicitly prefer python3

2018-02-15 Thread W. Trevor King
On Thu, Feb 15, 2018 at 07:37:53AM +0200, Tomi Ollila wrote:
> In this case I value Trevor as valid notmuch maintainer as anyone
> else who has done significant work for nmbug.

Thanks, but I don't think that should impact the decision for this
patch.  I'm just sharing my take, but the eventual decisions are up to
David (and others with push access to the main repo?).  I'll certainly
continue to contribute to nmbug if their decision is to use python3
shebangs ;).

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] nmbug: explicitly prefer python3

2018-02-12 Thread W. Trevor King
On Sun, Feb 11, 2018 at 10:56:36PM -0500, Daniel Kahn Gillmor wrote:
> On Fri 2018-02-09 12:46:24 -0800, W. Trevor King wrote:
> > From later on in PEP 394 [1]:
> >
> >   It is anticipated that there will eventually come a time where
> >   the third party ecosystem surrounding Python 3 is sufficiently
> >   mature for this recommendation to be updated to suggest that the
> >   python symlink refer to python3 rather than python2.
> >
> > And from right up at the beginning [2]:
> >
> >   however, end users should be aware that python refers to python3
> >   on at least Arch Linux (that change is what prompted the
> >   creation of this PEP), so python should be used in the shebang
> >   line only for scripts that are source compatible with both
> >   Python 2 and 3.
> >
> > On my Gentoo system, I've also selected Python 3 to back ‘python’.
> > So I think your solution should be “add a /usr/bin/python symlink
> > to your python3”, not “claim that nmbug is only compatible with
> > Python 3”.
> 
> Presumably you still have /usr/bin/python3 in addition to
> /usr/bin/python as well.  So the one thing i think we're both
> agreeing on is that we use nmbug with python 3.

Yup.  But I'm not sure that is the case for all nmbug users.

> It looks to me like you're asking me to change my operating system
> to accomodate your naming preference.

No, I'm asking you to change your operating system to accommodate PEP
394's naming preferences.  As PEP 394 points out, Arch made the switch
to using ‘python’ for ‘python3’ long ago.  You'd just be following
their lead.

> I'm asking that we put the onus on developers who really insist on
> using nmbug with python 2.7 maintain their own local patch against
> nmbug, rather than other developers either modifying their local
> operating system in potentially disastrous ways (/usr/bin/python as
> python3 would cause severe breakage for at least one python2-only
> tool i rely on daily, sadly)…

That Python-2-only tool should be using python2 in its shebang.  This
is exactly the sort of issue that PEP 394 was created to address.
Once you patch that tool to follow PEP 394, you should have no problem
adjusting your system to also follow PEP 394.

> … or carrying their own local patch against nmbug.

A shebang with ‘python’ should work with everyone (and it's what PEP
394 recommends for scripts that work with both Python major versions).
The only folks who would need a local patch would be folks with
systems like your current plan that contain no ‘python’ command at
all.  I see no upside to such systems, while I do see upsides to
systems with just a ‘python2’ (and a ‘python’ alias for it) or just a
‘python3’ (and a ‘python’ alias for it).

> i'll drop this request now because i don't understand the origin of
> the strength of your reaction, and already wish i'd spent the time
> i've lost on it on something more productive :( I hope if you change
> your mind you'll come back and recommend it here.

I like nmbug and have put some time into it.  But I'm not the notmuch
maintainer, and as you point out, nmbug would still work for me with a
python3 shebang.  So if the maintainers want to switch to python3 it's
no skin off my back.  They can always wait and field requests from any
python2-only users if/when those users file complaints (which may be
never).

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] nmbug: explicitly prefer python3

2018-02-09 Thread W. Trevor King
On Fri, Feb 09, 2018 at 01:36:48PM -0500, Daniel Kahn Gillmor wrote:
> > Is there something using python3 gets you for nmbug that you miss
> > with python2?
>
> Yep, i get to remove python 2 from my operating system :)
> 
> Smaller installed codebase, fewer bugs.  There are only two
> outstanding holdovers for me, and nmbug is one of them.

From later on in PEP 394 [1]:

  It is anticipated that there will eventually come a time where the
  third party ecosystem surrounding Python 3 is sufficiently mature
  for this recommendation to be updated to suggest that the python
  symlink refer to python3 rather than python2.

And from right up at the beginning [2]:

  however, end users should be aware that python refers to python3 on
  at least Arch Linux (that change is what prompted the creation of
  this PEP), so python should be used in the shebang line only for
  scripts that are source compatible with both Python 2 and 3.

On my Gentoo system, I've also selected Python 3 to back ‘python’.  So
I think your solution should be “add a /usr/bin/python symlink to your
python3”, not “claim that nmbug is only compatible with Python 3”.

Cheers,
Trevor

[1]: 
https://www.python.org/dev/peps/pep-0394/#future-changes-to-this-recommendation
[2]: https://www.python.org/dev/peps/pep-0394/#abstract

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] nmbug: explicitly prefer python3

2018-02-09 Thread W. Trevor King
On Thu, Feb 08, 2018 at 11:32:11PM -0500, Daniel Kahn Gillmor wrote:
> nmbug and notmuch-report are developer tools.  It's 2018, and all
> developers should have python3 available.

From PEP 394 [1]:

  One exception to this is scripts that are deliberately written to be
  source compatible with both Python 2.x and 3.x.  Such scripts may
  continue to use python on their shebang line without affecting their
  portability.

So while everyone who uses nmbug may have python3, I don't see a need
to pick sides.  Is there something using python3 gets you for nmbug
that you miss with python2?

Cheers,
Trevor

[1]: https://www.python.org/dev/peps/pep-0394/#recommendation

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 1/2] nmbug: Bump to version 0.3

2017-12-28 Thread W. Trevor King
Changes since 0.2:

* Accept failures to unset core.worktree in clone (0a155847,
  2017-10-10, unreleased).
* Use --no-renames in log (f9189a06, 2016-09-26, v0.24).
* Auto-checkout in clone if it wouldn't clobber (7ef3b653, 2017-10-10,
  unreleased).
* Add a 'help' command for folks who don't like --help
  (9d25c97d, 2014-10-03, v0.20).
* Setup a 'config' branch on clone to track origin/config (244f8739,
  2015-03-22, v0.20).  This branch may be consumed by
  notmuch-report(1).
* Only error for invalid diff lines in tags/ (57225988, 2017-10-16,
  unreleased).
* Ignore # comments in 'notmuch dump ...' output (9bbc54bd,
  2016-03-27, v0.22).
* Respect 'expect' in _spawn(..., wait=True) (e263c5b1, 2017-10-10,
  unreleased).
* Update URLs in documentation (554b90b5 and 6a833a6e8, 2016-06-02,
  v0.23).
---
 devel/nmbug/nmbug | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index 8c7e925c..c35dd75d 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -51,7 +51,7 @@ except ImportError:  # Python 2
 from urllib import unquote as _unquote
 
 
-__version__ = '0.2'
+__version__ = '0.3'
 
 _LOG = _logging.getLogger('nmbug')
 _LOG.setLevel(_logging.WARNING)
-- 
2.13.6

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


[PATCH 2/2] NEWS: Add nmbug 0.3 release notes to the notmuch 0.26 section

2017-12-28 Thread W. Trevor King
---
 NEWS | 13 +
 1 file changed, 13 insertions(+)

diff --git a/NEWS b/NEWS
index 6d2bf138..3b6404e7 100644
--- a/NEWS
+++ b/NEWS
@@ -41,6 +41,19 @@ Indexing cleartext of encrypted e-mails
   that the notmuch index itself is adequately protected.  DO NOT USE
   this feature without considering the security of your index.
 
+nmbug
+-
+
+nmbug's internal version increases to 0.3 in this notmuch release.
+User-facing changes with this notmuch release:
+
+* Accept failures to unset `core.worktree` in `clone`, which allows
+  nmbug to be used with Git 2.11.0 and later.
+* Auto-checkout in `clone` if it wouldn't clobber existing content,
+  which makes the initial clone more convenient.
+* Only error for invalid diff lines in `tags/`, which allows for
+  `README`s and similar in nmbug repositories.
+
 Notmuch 0.25.3 (2017-12-08)
 ===
 
-- 
2.13.6

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


[PATCH 0/2] nmbug: Bump to 0.3 and document in NEWS

2017-12-28 Thread W. Trevor King
As discussed previously in [1,2,3].  I've split this into two patches,
and only covered the changes since the last notmuch release.  There
have been additional changes since nmbug 0.2 (which went out with
notmuch 0.19), and I mention them in the commit message for patch 1/1,
but none of them seemed important enough to call out in NEWS.

I'm also fine leaving these changes out of NEWS and just bumping the
nmbug version (which is why I split this series into two patches).

Cheers,
Trevor

[1]: id:cover.1507675236.git.wk...@tremily.us
 Subject: [PATCH 0/3] nmbug:
 Date: Tue, 10 Oct 2017 15:49:48 -0700
[2]: id: id:20171211174707.gx19...@valgrind.us
 Subject: Re: [PATCH 3/4] nmbug: Auto-checkout in clone if it
   wouldn't clobber
 Date: Mon, 11 Dec 2017 09:47:07 -0800
[3]: id:87a7ypdm3p@tesseract.cs.unb.ca
 Subject: Re: [PATCH 3/4] nmbug: Auto-checkout in clone if it
   wouldn't clobber
 Date: Mon, 11 Dec 2017 16:51:38 -0400

W. Trevor King (2):
  nmbug: Bump to version 0.3
  NEWS: Add nmbug 0.3 release notes to the notmuch 0.26 section

 NEWS  | 13 +
 devel/nmbug/nmbug |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

-- 
2.13.6

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


Re: [PATCH 3/4] nmbug: Auto-checkout in clone if it wouldn't clobber

2017-12-11 Thread W. Trevor King
On Mon, Dec 11, 2017 at 09:10:47AM -0400, David Bremner wrote:
> Not sure what happened to patch 4/4?

Ah sorry.  My local branch has a commit to bump nmbug's internal
version to 0.3 (see my comments in [1]), but I ended up deciding to
punt that until before the next notmuch release (in case other nmbug
changes landed in the meantime) and forgot to update the denominator.

Based on [2], perhaps it is now time?  Or is [3] likely to land before
the freeze?

Cheers,
Trevor

[1]: id:cover.1507675236.git.wk...@tremily.us
 Subject: [PATCH 0/3] nmbug:
 Date: Tue, 10 Oct 2017 15:49:48 -0700
[2]: id:87efo222nr@tethera.net
 Subject: Notmuch 0.26 release schedule
 Date: Sun, 10 Dec 2017 08:22:32 -0400
[3]: id:4487e001b350aa8e343a1201d869cceca2a03ab6.1508176853.git.wk...@tremily.us
 Subject: [PATCH] nmbug: Only error for invalid diff lines in tags/
 Date: Mon, 16 Oct 2017 11:01:47 -0700  

   

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: web interface to notmuch

2017-10-20 Thread W. Trevor King
I haven't looked at the backing code in a while, but I really like the
public-inbox [1] approach to archival.  Since Gmane died, Git (and a
few other projects [2]) have also been using the author's hosted
version.  I haven't looked at the backing code in a while, but it's
live Perl, not a static site.  It uses Xapian for search (like
notmuch), but I was unable to talk Eric into using notmuch directly
because of our lack of Perl bindings [3].  Still, it's a pretty
similar idea, and it may be a good fit for you.  Previous discussion
on this list in [4,5].

Cheers,
Trevor

[1]: https://public-inbox.org/README.html
[2]: https://public-inbox.org/hosted.html
[3]: https://public-inbox.org/meta/20141027005553.ga10...@dcvr.yhbt.net/
[4]: id:20141107190321.gl23...@odin.tremily.us
[5]: id:20160820062931.gy30...@odin.tremily.us

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: nmbug backtrace due to .mailmap

2017-10-16 Thread W. Trevor King
On Mon, Oct 16, 2017 at 02:08:17PM -0700, W. Trevor King wrote:
> So I've pushed bce5a55c removing .mailmap, and folks without [1]
> should be back in business.
> …
> [1]: 
> id:4487e001b350aa8e343a1201d869cceca2a03ab6.1508176853.git.wk...@tremily.us

But Jani reports still being stuck.  It turns out that anyone who
pulled after 5ea99ebc but before bce5a55c will have problems with a
failing pull's early _insist_committed check, which depends on
get_status.  Anyone who cannot 'nmbug pull' due to the .mailmap should
either:

a. Apply the patch and try again.

b. Comment out the ‘_insist_committed()’ line in nmbug's ‘pull’
   definition and try again.  Make sure you restore the check after
   the successful pull.

c. Bypass nmbug and update their Git repository directly, using
   something like:

 $ GIT_DIR="${NMBGIT:=${HOME}/.nmbug}"
 $ GIT_WORK_TREE=$(mktemp -d)
 $ export GIT_DIR GIT_WORK_TREE
 $ git reset --hard HEAD
 $ git pull
 $ rm -rf "${GIT_WORK_TREE}"

   which is basically what ‘nmbug pull’ does, but translated from
   Python into shell.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: nmbug backtrace due to .mailmap

2017-10-16 Thread W. Trevor King
On Mon, Oct 16, 2017 at 05:37:32PM -0300, David Bremner wrote:
> W. Trevor King writes:
> > On Mon, Oct 16, 2017 at 10:14:40PM +0300, Jani Nikula wrote:
> >> I also didn't see any discussion about adding a .mailmap prior to it
> >> being pushed.
> >
> > Sorry :/.  I didn't realize it would be an issue until I pushed it.  I
> > can't roll it back because the central repo only allows fast-forward
> > pushes, but maybe David can revert master to 4148cb4 (dropping
> > 5ea99eb)?  Until then, you can work around the current master by
> > applying this patch locally.
> 
> Reverts are fast-forward?

Ah, I'd been thinking of rewinding master, but yeah, pushing an
explicit revert commit should work too.  There may be cases where a
client that does not include [1] still manages to find and choke on
.mailmap, but I haven't been able to think up anything that sounds
likely.  And as Jani pointed out in IRC, rolling back public branches
has its own set of problems [2].

So I've pushed bce5a55c removing .mailmap, and folks without [1]
should be back in business.  Sorry for the excitement :p.

Cheers,
Trevor

[1]: id:4487e001b350aa8e343a1201d869cceca2a03ab6.1508176853.git.wk...@tremily.us
[2]: https://git-scm.com/docs/user-manual#problems-With-rewriting-history

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: nmbug backtrace due to .mailmap

2017-10-16 Thread W. Trevor King
On Mon, Oct 16, 2017 at 12:21:15PM -0700, W. Trevor King wrote:
> Until then, you can work around the current master by applying this
> patch locally.

I'd thought this thread was in response to my patch, but it turns out
my local nullmailer was off when I sent the patch.  Sent now, and
“this patch” means:

  id:4487e001b350aa8e343a1201d869cceca2a03ab6.1508176853.git.wk...@tremily.us

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] nmbug: Only error for invalid diff lines in tags/

2017-10-16 Thread W. Trevor King
Avoid:

  Traceback (most recent call last):
File "/home/nmbug/bin/nmbug", line 834, in 
  args.func(**kwargs)
File "/home/nmbug/bin/nmbug", line 385, in checkout
  status = get_status()
File "/home/nmbug/bin/nmbug", line 580, in get_status
  maybe_deleted = _diff_index(index=index, filter='D')
File "/home/nmbug/bin/nmbug", line 658, in _diff_index
  for id, tag in _unpack_diff_lines(stream=p.stdout):
File "/home/nmbug/bin/nmbug", line 678, in _unpack_diff_lines
  'Invalid line in diff: {!r}'.format(line.strip()))
  ValueError: Invalid line in diff: u'.mailmap'

With this commit, folks can commit READMEs, .mailmap, etc. to their
nmbug repositories, and 'nmbug diff' and 'status' won't choke on them.
If you want to check for this sort of thing, you can set --log-level
to info or greater.  nmbug will still error if the unrecognized path
is under tags/, since that's more likely to be a user error.
---
 devel/nmbug/nmbug | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index 6febf16f..0602e138 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -65,7 +65,8 @@ if _os.path.isdir(_NMBGIT):
 
 TAG_PREFIX = _os.getenv('NMBPREFIX', 'notmuch::')
 _HEX_ESCAPE_REGEX = _re.compile('%[0-9A-F]{2}')
-_TAG_FILE_REGEX = _re.compile('tags/(?P[^/]*)/(?P[^/]*)')
+_TAG_DIRECTORY = 'tags/'
+_TAG_FILE_REGEX = _re.compile(_TAG_DIRECTORY + '(?P[^/]*)/(?P[^/]*)')
 
 # magic hash for Git (git hash-object -t blob /dev/null)
 _EMPTYBLOB = 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'
@@ -674,8 +675,11 @@ def _unpack_diff_lines(stream):
 for line in stream:
 match = _TAG_FILE_REGEX.match(line.strip())
 if not match:
-raise ValueError(
-'Invalid line in diff: {!r}'.format(line.strip()))
+message = 'non-tag line in diff: {!r}'.format(line.strip())
+if line.startswith(_TAG_DIRECTORY):
+raise ValueError(message)
+_LOG.info(message)
+continue
 id = _unquote(match.group('id'))
 tag = _unquote(match.group('tag'))
 yield (id, tag)
-- 
2.13.6

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


Re: nmbug backtrace due to .mailmap

2017-10-16 Thread W. Trevor King
On Mon, Oct 16, 2017 at 10:14:40PM +0300, Jani Nikula wrote:
> Presumably because of the .mailmap added in nmbug repository:

Yup.

> I also didn't see any discussion about adding a .mailmap prior to it
> being pushed.

Sorry :/.  I didn't realize it would be an issue until I pushed it.  I
can't roll it back because the central repo only allows fast-forward
pushes, but maybe David can revert master to 4148cb4 (dropping
5ea99eb)?  Until then, you can work around the current master by
applying this patch locally.

And if folks feel like this sort of thing should not be supported,
we'll want to reject this patch, document the limitation, and roll
back master to drop 5ea99eb.  I like it, but it's really David's
central repo.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 0/3] nmbug: clone core.worktree and auto-checkout (was: [PATCH 0/3] nmbug:)

2017-10-16 Thread W. Trevor King
On Sat, Oct 14, 2017 at 03:51:08PM +0300, Jani Nikula wrote:
> Could we add a "nmbug required version" metadata to the repository…

I'm not sure what you mean.  The wiki page will mention the minimum
nmbug version with which the wiki instructions are compatible (as it
already does, [1]).  But that's just for folks who are reading the
wiki and executing the suggested commands.  There's no nmbug
requirement for the repository itself, and the file format inside
nmbug repositories hasn't changed since nmbug was created in ebd1adc5
(contrib/nmbug: new script for sharing tags with a given prefix,
2011-11-12).  If you think we need a clearer version requirement, can
you complete “You need at least this version of nmbug to …”?

Cheers,
Trevor

[1]: https://notmuchmail.org/nmbug/

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Public notmuch.mbox missing some messages which are tagged in nmbug

2017-10-10 Thread W. Trevor King
I was dusting off my local nmbug repository today, and noticed that
some messages are tagged in the nmbug repository [1] but missing from
our mbox archive [2].  Here's a list:

  $ nmbug status
  U   20170509021719.13086-2-da...@tethera.netobsolete
  U   20170509021719.13086-2-da...@tethera.netpatch
  U   20170509021719.13086-3-da...@tethera.netobsolete
  U   20170509021719.13086-3-da...@tethera.netpatch
  U   20170509021719.13086-4-da...@tethera.netobsolete
  U   20170509021719.13086-4-da...@tethera.netpatch
  U   20170813074533.2226-1-j...@nikula.org   obsolete
  U   20170813074533.2226-1-j...@nikula.org   patch
  U   
2fc048ce68331b233ee16b99719635fe7d8a882f.1494445220.git.j...@nikula.org patch
  U   
2fc048ce68331b233ee16b99719635fe7d8a882f.1494445220.git.j...@nikula.org pushed
  U   
5fc2d4dd230648ea4939bb06f0bb0ac30c5a8fd3.1494445220.git.j...@nikula.org patch
  U   
5fc2d4dd230648ea4939bb06f0bb0ac30c5a8fd3.1494445220.git.j...@nikula.org pushed
  U   86lgngplvt@phe.ftfl.ca  moreinfo
  U   86lgngplvt@phe.ftfl.ca  patch
  U   
908464f22bc477ad9a986c622aad50a345a5f20d.1494445220.git.j...@nikula.org patch
  U   
908464f22bc477ad9a986c622aad50a345a5f20d.1494445220.git.j...@nikula.org pushed
  U   
f7ffa56ea5e973ff2a76dc5637e83bf47928ef83.1494445220.git.j...@nikula.org patch
  U   
f7ffa56ea5e973ff2a76dc5637e83bf47928ef83.1494445220.git.j...@nikula.org pushed

Some of those have Message-IDs which suggest their generation date,
but we can lookup the first tag for each message ID in the nmbug
history regardless:

  $ for id in $(nmbug status | awk '{print $2}' | uniq);
  > do
  >   nmbug log -- --date=short --format='%ad %h %an %s' --reverse -- 
"tags/${id}" | head -n1;
  > done | sort | uniq
  2017-05-08 65b227d David Bremner 
  2017-05-10 5e0caf7 David Bremner 
  2017-07-22 17f6f80 David Bremner 
  2017-08-14 e82eb9c David Bremner 

If somebody has copies of those messages, can they push them up into
the mbox?  Maybe they went to the freelists list [3]?  Maybe they were
off-list?  Maybe they just missed inclusion in the mbox?

There may be more messages missing from the archive which I happen to
have locally (e.g. maybe I was CCed), and I haven't checked for those.
But I know the entries listed above were missing as of 2017-10-10
20:41 UTC (my most recent archive download).

Cheers,
Trevor

[1]: https://notmuchmail.org/nmbug/
 http://nmbug.notmuchmail.org/git/nmbug-tags.git
[2]: https://notmuchmail.org/archives/notmuch.mbox
[3]: https://www.freelists.org/list/notmuch

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 1/4] nmbug: Respect 'expect' in _spawn(..., wait=True)

2017-10-10 Thread W. Trevor King
Fixing a bug from 7f2cb3be (nmbug: Translate to Python, 2014-10-03).
The bug had no direct impact though, because none of the wait=True
callers were setting expect.

Also add expected codes to the debug messages, to help log readers
understand why nonzero exits are occasionally accepted.
---
 devel/nmbug/nmbug | 12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index 6febf16f..755bd7db 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -169,8 +169,9 @@ class _SubprocessContextManager(object):
 stream.close()
 setattr(self._process, name, None)
 status = self._process.wait()
-_LOG.debug('collect {args} with status {status}'.format(
-args=self._args, status=status))
+_LOG.debug(
+'collect {args} with status {status} (expected {expect})'.format(
+args=self._args, status=status, expect=self._expect))
 if status not in self._expect:
 raise SubprocessError(args=self._args, status=status)
 
@@ -211,13 +212,14 @@ def _spawn(args, input=None, additional_env=None, 
wait=False, stdin=None,
 input = input.encode(encoding)
 (stdout, stderr) = p.communicate(input=input)
 status = p.wait()
-_LOG.debug('collect {args} with status {status}'.format(
-args=args, status=status))
+_LOG.debug(
+'collect {args} with status {status} (expected {expect})'.format(
+args=args, status=status, expect=expect))
 if stdout is not None:
 stdout = stdout.decode(encoding)
 if stderr is not None:
 stderr = stderr.decode(encoding)
-if status:
+if status not in expect:
 raise SubprocessError(
 args=args, status=status, stdout=stdout, stderr=stderr)
 return (status, stdout, stderr)
-- 
2.13.6

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


[PATCH 3/4] nmbug: Auto-checkout in clone if it wouldn't clobber

2017-10-10 Thread W. Trevor King
We currently auto-checkout after pull and merge to make those more
convenient.  They're guarded against data-loss with a leading
_insist_committed().  This commit adds the same convenience to clone,
since in most cases users will have no NMBPREFIX-prefixed tags in
their database when they clone.  Users that *do* have
NMBPREFIX-prefixed tags will get a warning (and I've bumped the
default log level to warning so folks who don't set --log-level will
see it) like:

  $ nmbug clone http://nmbug.notmuchmail.org/git/nmbug-tags.git
  Cloning into '/tmp/nmbug-clone.g9dvd0tv'...
  Checking connectivity: 16674, done.
  Branch config set up to track remote branch config from origin.
  Not checking out to avoid clobbering existing tags: notmuch::0.25, ...
---
 devel/nmbug/nmbug | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index c0e7c3c6..0cd91148 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -54,7 +54,7 @@ except ImportError:  # Python 2
 __version__ = '0.2'
 
 _LOG = _logging.getLogger('nmbug')
-_LOG.setLevel(_logging.ERROR)
+_LOG.setLevel(_logging.WARNING)
 _LOG.addHandler(_logging.StreamHandler())
 
 NMBGIT = _os.path.expanduser(
@@ -311,6 +311,13 @@ def clone(repository):
 _git(args=['config', '--unset', 'core.worktree'], wait=True, expect=(0, 5))
 _git(args=['config', 'core.bare', 'true'], wait=True)
 _git(args=['branch', 'config', 'origin/config'], wait=True)
+existing_tags = get_tags()
+if existing_tags:
+_LOG.warning(
+'Not checking out to avoid clobbering existing tags: {}'.format(
+', '.join(existing_tags)))
+else:
+checkout()
 
 
 def _is_committed(status):
-- 
2.13.6

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


[PATCH 2/4] nmbug: Accept failures to unset core.worktree in clone

2017-10-10 Thread W. Trevor King
Since 6311cfaf (init: do not set unnecessary core.worktree,
2016-09-25, 2.11.0 [1]), Git has no longer set core.worktree when
--separate-git-dir is used.  This broke clone with:

  $ nmbug clone http://nmbug.notmuchmail.org/git/nmbug-tags.git
  Cloning into '/tmp/nmbug-clone.33gg442e'...
  Checking connectivity: 16674, done.
  ['git', '--git-dir', '/home/wking/.nmbug', 'config', '--unset', 
'core.worktree'] exited with 5
  $ echo $?
  1

The initial discussion that lead to the Git change is in [2], and
there is some more discussion around this specific change in [3].
There is some useful background on working trees in this 2009 message
[4].  There is also a git-worktree(1) since df0b6cfb (worktree: new
place for "git prune --worktrees", 2015-06-29, 2.5.0 [5]) which grew
the ability to add new worktrees in 799767cc (Merge branch
'es/worktree-add', 2015-07-13, 2.5.0 [6]).  Folks relying on
core.worktree in the --separate-git-dir case fall into the "former
case" in [4], and as Junio pointed out in that message, Git
operations like 'add' don't really work there.

In nmbug we don't want core.worktree, because our effective working
tree is the notmuch database.  By accepting failed core.worktree
unsets, clone will work with Gits older and younger than 2.11.0.

[1]: https://github.com/git/git/commit/6311cfaf93716bcc43dd1151cb1763e3f80d8099
[2]: 
https://public-inbox.org/git/calqjkkzo_y0dncrjjooyz7eso7ybmghvz6fe92oo4su7jec...@mail.gmail.com/
[3]: https://public-inbox.org/git/87h94d8cwi@kyleam.com/
[4]: https://public-inbox.org/git/7viqbsw2vn@alter.siamese.dyndns.org/
[5]: https://github.com/git/git/commit/df0b6cfbda88144714541664fb501146d6465a82
[6]: https://github.com/git/git/commit/799767cc98b2f8e6f82d0de4bef9b5e8fcc16e97

Reported-by: Daniel Kahn Gillmor 
---
 devel/nmbug/nmbug | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index 755bd7db..c0e7c3c6 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -308,7 +308,7 @@ def clone(repository):
 'git', 'clone', '--no-checkout', '--separate-git-dir', NMBGIT,
 repository, workdir],
 wait=True)
-_git(args=['config', '--unset', 'core.worktree'], wait=True)
+_git(args=['config', '--unset', 'core.worktree'], wait=True, expect=(0, 5))
 _git(args=['config', 'core.bare', 'true'], wait=True)
 _git(args=['branch', 'config', 'origin/config'], wait=True)
 
-- 
2.13.6

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


[PATCH 0/3] nmbug:

2017-10-10 Thread W. Trevor King
Two changes and a bugfix spun off from today's IRC disussion.

We probably also want to bump nmbug's __version__ to 0.3.  Changes
since 0.2, including the patches in this series, ordered by decreasing
impact on 0.2 users:

* Accept failures to unset core.worktree in clone (this series).
* Use --no-renames in log (f9189a06, 2016-09-26, v0.24).
* Auto-checkout in clone if it wouldn't clobber (this series).
* Add a 'help' command for folks who don't like --help (9d25c97d, 2014-10-03, 
v0.20).
* Setup a 'config' branch on clone to track origin/config (244f8739,
  2015-03-22, v0.20).  This branch may be consumed by notmuch-report(1).
* Ignore # comments in 'notmuch dump ...' output (9bbc54bd, 2016-03-27, v0.22).
* Respect 'expect' in _spawn(..., wait=True) (this series).
* Update URLs in documentation (554b90b5 and 6a833a6e8, 2016-06-02, v0.23).

I expect the best time to make that bump is just before we cut our
next notmuch release.  Once we do, we can update the wiki page [1] to
suggest nmbug 0.3+ and remove the checkout step from “Getting
started”.

Cheers,
Trevor

[1]: https://notmuchmail.org/nmbug/

W. Trevor King (3):
  nmbug: Respect 'expect' in _spawn(..., wait=True)
  nmbug: Accept failures to unset core.worktree in clone
  nmbug: Auto-checkout in clone if it wouldn't clobber

 devel/nmbug/nmbug | 25 +
 1 file changed, 17 insertions(+), 8 deletions(-)

-- 
2.13.6

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


Re: [PATCH] nmbug: allow excluded messages

2016-10-22 Thread W. Trevor King
On Sat, Oct 22, 2016 at 08:59:40AM +0100, Mark Walters wrote:
> This makes nmbug work even if the notmuch mailing list messages are
> excluded (i.e., have a tag in the excluded tags list).
> …
> (I think this is the only place it is needed, but I don't use nmbug
> much so I haven't tested thoroughly.)
> …
> --- a/devel/nmbug/nmbug
> +++ b/devel/nmbug/nmbug
> @@ -580,7 +580,7 @@ def get_status():
>  maybe_deleted = _diff_index(index=index, filter='D')
>  for id, tags in maybe_deleted.items():
>  (_, stdout, stderr) = _spawn(
> -args=['notmuch', 'search', '--output=files', 
> 'id:{0}'.format(id)],
> +args=['notmuch', 'search', '--output=files', '--exclude=false', 
> 'id:{0}'.format(id)],
>  stdout=_subprocess.PIPE,
>  wait=True)

Besides this call, we also use ‘notmuch search …’ in get_tags.  We may
need an --exclude=false there too to cover folks who exclude a tag
used by nmbug.

And ‘notmuch dump …’ doesn't appear to take an --exclude flag,
although it's based on searching so I'm not sure why not.

Anyhow, the idea looks good to me.  I'm just not clear enough on
exclude handling to know if this patch sufficiently covers it.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] nmbug: Add --no-renames to default log options

2016-09-26 Thread W. Trevor King
Git has supported this since b68ea12e (diff.c: respect diff.renames
config option, 2006-07-07, v1.4.2).  All of our information is in the
paths (the files are empty), so we don't want rename detection.  By
using --no-renames, we get entries like:

  $ nmbug log -- e473b453a2
  commit e473b453a25c072b5df67d834d822121373321f5
  Author: David Bremner 
  Date:   Sun Sep 25 07:54:11 2016 -0300

  D   tags/1474196252-31700-1-git-send-email-markwalters1...@gmail.com/0.23
  A   
tags/1474196252-31700-1-git-send-email-markwalters1...@gmail.com/pushed

  ...

Instead of the old:

  $ nmbug log -- e473b453a2
  commit e473b453a25c072b5df67d834d822121373321f5
  Author: David Bremner 
  Date:   Sun Sep 25 07:54:11 2016 -0300

  R100tags/1474196252-31700-1-git-send-email-markwalters1...@gmail.com/0.23 
  tags/1474196252-31700-1-git-send-email-markwalters1...@gmail.com/pushed
---
 devel/nmbug/nmbug | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index 1dd5f14..6febf16 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -475,7 +475,7 @@ def log(args=()):
 'nmbug log HEAD..@{upstream}'.
 """
 # we don't want output trapping here, because we want the pager.
-args = ['log', '--name-status'] + list(args)
+args = ['log', '--name-status', '--no-renames'] + list(args)
 with _git(args=args, expect=(0, 1, -13)) as p:
 p.wait()
 
-- 
2.1.0.60.g85f0837

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


Re: Mail archives in Git using ssoma

2016-08-21 Thread W. Trevor King
On Sun, Aug 21, 2016 at 06:37:04PM +, Eric Wong wrote:
> "W. Trevor King" <wk...@tremily.us> wrote:
> > On Fri, Nov 07, 2014 at 11:03:21AM -0800, W. Trevor King wrote:
> > > Eric Wong has been working on some tools to store email in a Git
> > > repository, and his client-side code is ssoma [1].  I wanted a bit
> > > more metadata than the stock ssoma-mda [2], and ended up just
> > > writing a ssoma-mda in Python [3]…
>
> Btw, for public-inbox, I'm using git-fast-import now, so imports are
> a bit faster and $GIT_DIR/ssoma.index is no longer used.  This was
> crucial for getting git@vger archives imported in a reasonable time.
>
> public-inbox-* still keeps ssoma.index up-to-date for backwards
> compatibility with ssoma, and will probably do so until 2020 or
> later (there'll be a few years of deprecation notices)
>
> So I or someone else needs to update Perl ssoma to use fast-import
> at some point, too; and I suggest your python version do the same.

ssoma-mda imports 22k notmuch messages in around 15 minutes (with
profiling enabled), and:

  $ python -m cProfile -o profile import.py notmuch.mbox
  $ python -c "import pstats; p=pstats.Stats('profile'); 
p.sort_stats('cumulative').print_stats(10)"
  Sun Aug 21 12:56:49 2016profile

   101823722 function calls (99078415 primitive calls) in 885.069 
seconds

 Ordered by: cumulative time
 List reduced from 1145 to 10 due to restriction <10>

 ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   70/10.0020.000  885.069  885.069 {built-in method exec}
  10.1110.111  885.069  885.069 
/home/wking/src/notmuch/notmuch-archives.git/import.py:9()
  10.4000.400  884.915  884.915 
/home/wking/src/notmuch/notmuch-archives.git/import.py:17(import_mbox)
  228750.6010.000  863.3710.038 
/home/wking/src/notmuch/notmuch-archives.git/ssoma_mda.py:362(deliver)
  228758.9430.000  810.4590.035 
/home/wking/src/notmuch/notmuch-archives.git/ssoma_mda.py:207(append)
  228750.4180.000  308.3530.013 
/home/wking/.local/lib64/python3.4/site-packages/pygit2/index.py:146(write_tree)
  22875  307.8550.013  307.8550.013 {built-in method 
git_index_write_tree}
  228740.5750.000  279.2930.012 
/home/wking/.local/lib64/python3.4/site-packages/pygit2/index.py:238(diff_to_tree)
  22874  278.5010.012  278.5010.012 {built-in method 
git_diff_tree_to_index}
  228750.0880.000   80.4130.004 
/home/wking/.local/lib64/python3.4/site-packages/pygit2/index.py:99(read)

38 ms per ssoma delivery is probably fast enough, especially if you
are invoking ssoma-mda once per message, since process setup will take a 
similar amount of time:

  $ time python -c 'print("hello")'
  hello

  real0m0.016s
  user0m0.013s
  sys 0m0.003s

It's possible that fast-import would shave a few ms off the pygit2
addition (I'm not sure, and maybe pygit2 is faster than fast-import).
But I doubt it matters enough either way to be worth changing unless
you are dealing with a really large corpus.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Mail archives in Git using ssoma (Docker image)

2016-08-21 Thread W. Trevor King
On Sun, Aug 21, 2016 at 12:08:52PM +, Eric Wong wrote:
> "W. Trevor King" <wk...@tremily.us> wrote:
> > This is the ssoma archive (with the data in it).  I just set up a
> > basic HTTP archive (following [1]) based on a Docker image [2] (Gentoo
> > doesn't package all the Perl dependencies public-inbox needs).
> 
> Ugh, that sucks (sorry, not a fan of Docker).
> 
> What's missing from Gentoo?

Gentoo doesn't package (or I couldn't find the package for)
Encode::MIME::Header or Mail::Thread.  I tried installing things from
CPAN, but ran into a compile-time error from the ‘cpan’ invocationand
gave up ;).  I can try and reproduce the error if you're curious, but
I don't have it handy at the moment.

> >   $ git config -f srv/notmuch.git/config publicinbox.http http://tremily.us
> >   $ git config -f srv/notmuch.git/config publicinbox.email 
> > notmuch@notmuchmail.org
> 
> That should probably be:
> 
>   ; based on your [3]
>   git config -f srv/notmuch.git/config \
>   publicinbox.notmuch.url http://tremily.us/notmuch
> 
>   git config -f srv/notmuch.git/config \
>   publicinbox.notmuch.address notmuch@notmuchmail.org
> 
>   ; this is crucial for all the public-inbox-* tools
>   git config -f srv/notmuch.git/config \
>   publicinbox.notmuch.mainrepo /path/to/notmuch.git

I was using these in the Dockerfile's CMD:

  (cd /srv;
   for NAME in *;
   do
 CONF="/srv/${NAME}/config";
 public-inbox-init "${NAME}" "/srv/${NAME}" $(git config -f "${CONF}" 
publicinbox.http) $(git config -f "${CONF}" publicinbox.email);
   done) && …

Are you saying that I can skip the ~/.public-inbox/config entries
setup by public-inbox-init if I set publicinbox.{name}.* in the ssoma
repository's config?  That would be nice.

I don't see a point to having {name} in ssoma-config settings though,
since you're already in a single bucket by that point (using
publicinbox.{name}.* makes sense in the multi-bucket
~/.public-inbox/config).

> > It's not updating automatically yet, but that will probably look
> > like:
> > 
> > 1. Pull new mbox [4].
> > 2. Import into notmuch-archives [5].
> > 3. Re-run public-inbox-index (this could probably be via ‘docker exec …’.
> > 
> > But I'll have to test that to confirm.  And ideally we'd be using
> > ssoma-mda or similar directly, instead of going through mbox, but I'd
> > rather get the official headers on the stored mail than be efficient
> > ;).
> 
> For mirroring existing lists, I started using public-inbox-watch
> which currently watches Maildirs.

If I had a Maildir locally, I'd just use procmail and push new
messages into ssoma-mda.  I'm using the import script because my local
mail has “how we delivered this to Trevor” headers (which I don't want
to add) but the downloaded mbox has “how we delivered this to
notmuch@notmuchmail.org” (which seems like a better fit for a shared
ssoma repo).

> I recommend public-inbox-watch for mirroring existing lists (such as
> what I did with git@vger) but public-inbox-mda for self-hosted lists
> (such as m...@public-inbox.org).

Why is that?  Procmail + public-inbox-mda (or my Python ssoma-mda fork
[1,2]) seems simpler and equally effective if you want to insert a
message that your mail system is delivering locally.

> > One shift from Gmane's mid.gmane.org/… is that the public-inbox UI
> > Message-ID lookup is per-bucket, and public-inbox seems to be
> > encouraging per-list buckets.
> 
> The public-inbox-nntpd interface supports mid lookups across all
> inboxes in that instance; so it should be doable in the WWW
> interface, too.  Either way, I think it has to be O(n) where (n) is
> the number of Xapian DBs, though.

I'm more concerned about the interface, and less about the
implementation (which can be improved later).  The (n) lookups are
trivially parallelizable, and you can always add a Message-ID →
buckets lookup table if (n) lookups turns out to be too slow.

Cheers,
Trevor

[1]: id:20141107190321.gl23...@odin.tremily.us
[2]: id:af679af8257e250ac606e35a1307ad02907b8426.1413663212.git.wk...@tremily.us
 
http://public-inbox.org/meta/af679af8257e250ac606e35a1307ad02907b8426.1413663212.git.wk...@tremily.us/t/#u

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Mail archives in Git using ssoma (Docker image)

2016-08-21 Thread W. Trevor King
On Sat, Aug 20, 2016 at 09:36:31PM -0700, W. Trevor King wrote:
> [2]: git://tremily.us/notmuch-archives.git

This is the ssoma archive (with the data in it).  I just set up a
basic HTTP archive (following [1]) based on a Docker image [2] (Gentoo
doesn't package all the Perl dependencies public-inbox needs).
Dockerfile for rebuilding the image is in [2].  I'm currently hosting
the archives (HTTP only) at [3].  Spinning that up from the Docker
image looks like:

  $ mkdir srv
  $ git clone --bare git://tremily.us/notmuch-archives.git srv/notmuch
  $ echo 'Notmuch -- Just an email system' >srv/notmuch.git/description
  $ git config -f srv/notmuch.git/config publicinbox.http http://tremily.us
  $ git config -f srv/notmuch.git/config publicinbox.email 
notmuch@notmuchmail.org
  $ docker run --name notmuch-archives -d -p 80:8080 -v ${PWD}/srv/:/srv/ 
wking/public-inbox

(although I'm using -p ###:8080 and have an Nginx reverse-proxy in
front).  It's not updating automatically yet, but that will probably
look like:

1. Pull new mbox [4].
2. Import into notmuch-archives [5].
3. Re-run public-inbox-index (this could probably be via ‘docker exec …’.

But I'll have to test that to confirm.  And ideally we'd be using
ssoma-mda or similar directly, instead of going through mbox, but I'd
rather get the official headers on the stored mail than be efficient
;).

One shift from Gmane's mid.gmane.org/… is that the public-inbox UI
Message-ID lookup is per-bucket, and public-inbox seems to be
encouraging per-list buckets.

And while I feel like I had a good grasp of the ssoma format two years
ago, I know very little about Perl and public-inbox.  I'm sure you
could setup a public-inbox host that is more efficient than what's
currently in my Docker image.

Cheers,
Trevor

[1]: http://public-inbox.org/INSTALL
[2]: https://hub.docker.com/r/wking/public-inbox/
[3]: http://tremily.us/notmuch/
[4]: https://notmuchmail.org/archives/notmuch.mbox
[5]: id:20160821043631.ga2...@odin.tremily.us

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [feature request] emacs: use `notmuch insert` for FCC

2016-08-20 Thread W. Trevor King
On Sat, Aug 20, 2016 at 02:14:38AM -0400, Steven Allen wrote:
> Tomi Ollila  writes:
> > PS: do we have an alternative to mid.gmane.org for
> > http://nmbug.tethera.net/status/
> 
> https://notmuchmail.org/pipermail/notmuch/? However, it's not
> indexed by id.

The Git folks seem to be transitioning to public-inbox / SSOMA
[1,2,3,4].  I floated a mostly-SSOMA conversion of the notmuch
archives a while back [5], and I can take a stab at dusting that off
and putting a public-inbox frontend in front of it, although I'd
rather have someone more central to notmuch handle long-term hosting.

Cheers,
Trevor

[1]: https://public-inbox.org/git/
[2]: https://github.com/git/git-scm.com/pull/827#issuecomment-240737837
[3]: https://public-inbox.org/git/20160728135249.ga25...@sigill.intra.peff.net/
 id:20160728135249.ga25...@sigill.intra.peff.net
[4]: https://public-inbox.org/git/20140507065903.ga32...@dcvr.yhbt.net/
 id:20140507065903.ga32...@dcvr.yhbt.net
[5]: id:20141107190321.gl23...@odin.tremily.us

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: syncing tags across machines

2016-07-09 Thread W. Trevor King
On Sat, Jul 09, 2016 at 07:54:05AM +0100, Stephen Eglen wrote:
> is there any robust solution yet to sharing/syncing tags across
> machines.  (e.g. a desktop and a laptop).

nmbug [1] is another way to version and share tags.  Set NMBPREFIX to
the empty string if you want to version all your tags with a
particular nmbug repository (and you can set NMBGIT if you want
several nmbug repositories).

Cheers,
Trevor

[1]: https://notmuchmail.org/nmbug/

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] nmbug: ignore # comments

2016-03-27 Thread W. Trevor King
On Sun, Mar 27, 2016 at 05:25:11PM -0300, David Bremner wrote:
>  for line in notmuch.stdout:
> +if line.strip().startswith('#'):
> +continue

Looks good to me.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] NEWS: Consolidate nmbug-status and notmuch-report sections

2016-03-24 Thread W. Trevor King
These are the same tool; the nmbug-status text just landed before the
name change.  We can also drop the message-url details from NEWS,
since they're already in the man page.
---
The integration fixes requested in [1].

Cheers,
Trevor

[1]: id:87r3f0jgg1.fsf@zancas.localnet
 http://thread.gmane.org/gmane.mail.notmuch.general/21554/focus=22064

 NEWS | 23 ---
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/NEWS b/NEWS
index 768f989..78d4708 100644
--- a/NEWS
+++ b/NEWS
@@ -39,28 +39,13 @@ users looking for generic notmuch reporting tools.
 The default configuration file name (extracted from the `config`
 branch of `NBMGIT` has changed from `status-config.json` to
 `notmuch-report.json` so it is more obviously associated with the
-report-generating script.
+report-generating script.  The configuration file also has a new
+`meta.message-url` setting, which is documented in
+`notmuch-report.json(5)`.
 
-nmbug-status
-
-
-`nmbug-status` now wraps query phrases in parentheses when and-ing
+`notmuch-report` now wraps query phrases in parentheses when and-ing
 them together, to avoid confusion about clause grouping.
 
-`nmbug-status` now supports `meta.message-url` to override the Gmane
-template.  For example, you can use:
-
-{
-  "meta": {
-"message-url": 
"https://groups.google.com/a/opencontainers.org/forum/#!search/messageid$3A%22{message-id}%22;
- ...
-  },
-  ...
-}
-
-To link to messages in the [opencontainers.org Google
-Groups](https://groups.google.com/a/opencontainers.org/forum/#!overview).
-
 Notmuch 0.21 (2015-10-29)
 =
 
-- 
2.1.0.60.g85f0837

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


Re: [PATCH v2 2/4] nmbug-status: Add meta.message-url config setting

2016-03-23 Thread W. Trevor King
On Wed, Mar 23, 2016 at 08:19:34AM -0300, David Bremner wrote:
> W. Trevor King writes:
> >  from __future__ import print_function
> > @@ -232,6 +232,10 @@ class Page (object):
> >  class HtmlPage (Page):
> >  _slug_regexp = re.compile('\W+')
> >
> > +def __init__(self, message_url_template, **kwargs):
> > +self.message_url_template = message_url_template
> > +super(HtmlPage, self).__init__(**kwargs)
> > +
>
> > @@ -395,6 +400,8 @@ _PAGES['text'] = Page()
> >  _PAGES['html'] = HtmlPage(
> >  header=header_template.format(**context),
> >  footer=footer_template.format(**context),
> > +message_url_template=config['meta'].get(
> > +'message-url', 'http://mid.gmane.org/{message-id}'),
> >  )
> >
>
> Maybe I'm missing some python knowledged, but it looks the
> constructor is defined to take a regular argument for
> message_url_template, but only passed in as a keyword. Does this
> really work?

Yup.  From [1]:

  positional-only: specifies an argument that can be supplied only by
position. Python has no syntax for defining positional-only
parameters. However, some built-in functions have positional-only
parameters (e.g. abs()).

I can't find a similar Python 3 glossary, but see [2].  Whether we use:

  def __init__(self, message_url_template, **kwargs):
  …

or:

  def __init__(self, message_url_template='foobar', **kwargs):
  …

just controls whether the message_url_template has a default or not,
and not whether it can be set via positional or keyword arguments.

There is Python syntax for keyword-only arguments, and it would look
like [2]:

  def __init__(self, *, message_url_template, **kwargs):
  …

or:

  def __init__(self, *, message_url_template='foobar', **kwargs):
  …

in the former case, you'd have to call __init__ with a
message_url_template=… keyword argument or you'd get:

  TypeError: __init__() missing 1 required keyword-only argument: 
'message_url_template'

With the latter case, calling __init__ without a message_url_template
argument would just get you the default value (‘foobar’ in these
examples).

Cheers,
Trevor

[1]: https://docs.python.org/2/glossary.html#term-parameter
[2]: 
https://docs.python.org/3/reference/compound_stmts.html#function-definitions

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: encoding of message-ids

2016-02-24 Thread W. Trevor King
On Wed, Feb 17, 2016 at 09:34:29AM -0400, David Bremner wrote:
> Daniel Kahn Gillmor writes:
> > That said, RFC 2047 suggest that its encodings are only relevant
> > in places where a "text" token would be used.  Message-ID (and
> > References and In-Reply-To) are intended to only contain
> > dot-atom-text tokens.  So probably it would be more correct to
> > avoid applying to these specific fields.
> >
> > i dunno that it's a big deal though, given the analysis above.
>
> I guess there are two seperate issues. One is the (mildly bogus)
> application of RFC2047 decoding to message-ids. The other other is
> the coercion into utf8 from whatever wacky 8bit encoding some
> creative person might use in a message-id.

It looks like there's already an “implicit encodings are complicated”
RFC discussing this issue [1].  RFC 6532 overrides (among other
things) the atext behind message-id [2,3] for message/global messages.
Other related RFCs cover internationalized domain names [4] and
internationalized email addresses [5].  I think we should:

* Store message IDs as NFKC UTF-8 in notmuch (do we already do this?).
* For message/global messages:
  * Convert headers to Unicode using UTF-8 (per RFC 6532).
* For non-message/global messages:
  * Ignore any RFC 2047 =? encoding or RFC 5890 xn-- encoding that may
be present.
  * Convert to Unicode by percent-encoding [6] (e.g. ‘ü%’ represented
as the three UTF-8 bytes ‘\xc3\xbc\x25’ would be represented by
the Unicode ‘%C3%BC%25’).

Cheers,
Trevor

[1]: https://tools.ietf.org/html/rfc6055
[2]: https://tools.ietf.org/html/rfc5322#section-3.6.4
[3]: https://tools.ietf.org/html/rfc5322#section-3.2.3
[4]: https://tools.ietf.org/html/rfc5890
[5]: https://tools.ietf.org/html/rfc6530
[6]: https://tools.ietf.org/html/rfc3986#section-2
[7]: https://tools.ietf.org/html/rfc2606#section-2

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] nmbug: Allow Unicode tags and IDs in Python 2

2016-02-14 Thread W. Trevor King
Avoid a UnicodeWarning and broken pipe on 'nmbug commit' in Python 2
when a tag or message ID contains non-ASCII characters [1].

There are a number of Python bugs associated with this behavior
[2,3,4,5,6].  There's also some useful background in [8].  [3] lead to
the currently working Python 3 implementation, which encodes to UTF-8
by default and has 'encoding' and 'errors' arguments [7].  This commit
follows that approach in a way that's compatible with both Python 2
and Python 3.  Coercing to UTF-8 (regardless of locale) gives us
consistent tag IDs for sharing between users.

The 'isnumeric' check identifies Unicode instances in both Python 2
[9] and Python 3 [10].

[1]: id:87twlbv5vj.fsf@zancas.localnet
 http://thread.gmane.org/gmane.mail.notmuch.general/21855/focus=21862
 Subject: Re: problems with nmbug and empty prefix (UnicodeWarning and 
broken pipe)
 Date: Sun, 14 Feb 2016 08:22:24 -0400
[2]: http://bugs.python.org/issue2637
[3]: http://bugs.python.org/issue3300
[4]: http://bugs.python.org/issue22231
[5]: http://bugs.python.org/issue23885
[6]: http://bugs.python.org/issue1712522
[7]: https://docs.python.org/3/library/urllib.parse.html#urllib.parse.quote
[8]: https://mail.python.org/pipermail/python-dev/2006-July/067335.html
[9]: https://docs.python.org/2/library/stdtypes.html#unicode.isnumeric
[10]: https://docs.python.org/3/library/stdtypes.html#str.isnumeric
---
I haven't checked the other commands for issues with Unicode IDs or
tags.  It's possible that in addition to this explicit encoding to
UTF-8, we'll also want explicit decoding from UTF-8 when reading from
Git trees (for 'nmbug checkout' and 'nmbug status').

Cheers,
Trevor

 devel/nmbug/nmbug | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index 81f582c..284d374 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright (c) 2011-2014 David Bremner <da...@tethera.net>
+# Copyright (c) 2011-2016 David Bremner <da...@tethera.net>
 #         W. Trevor King <wk...@tremily.us>
 #
 # This program is free software: you can redistribute it and/or modify
@@ -95,7 +95,7 @@ except AttributeError:  # Python < 3.2
 _tempfile.TemporaryDirectory = _TemporaryDirectory
 
 
-def _hex_quote(string, safe='+@=:,'):
+def _hex_quote(string, safe='+@=:,', encoding='utf-8', errors='strict'):
 """
 quote('abc def') -> 'abc%20def'.
 
@@ -103,6 +103,15 @@ def _hex_quote(string, safe='+@=:,'):
 addition to letters, digits, and '_.-') and lowercase hex digits
 (e.g. '%3a' instead of '%3A').
 """
+if hasattr(string, 'isnumeric'):
+string = string.encode(encoding, errors)
+if hasattr(safe, 'isnumeric'):
+safe_bytes = safe.encode(encoding, errors)
+if len(safe_bytes) != len(safe):
+raise ValueError(
+'some safe characters are encoded as multiple bytes '
+'({!r} -> {!r})'.format(safe, safe_bytes))
+safe = safe_bytes
 uppercase_escapes = _quote(string, safe)
 return _HEX_ESCAPE_REGEX.sub(
 lambda match: match.group(0).lower(),
-- 
2.1.0.60.g85f0837

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


Re: problems with nmbug and empty prefix (UnicodeWarning and broken pipe)

2016-02-14 Thread W. Trevor King
On Sun, Feb 14, 2016 at 08:22:24AM -0400, David Bremner wrote:
> W. Trevor King writes:
> >   for tag in tags:
> >   _LOG.debug('building a quoted path for {!r} / {!r}'.format(id, tag))
> >   path = 'tags/{id}/{tag}'.format(
> >   id=_hex_quote(string=id), tag=_hex_quote(string=tag))
> >   yield '{mode} {hash}\t{path}\n'.format(mode=mode, hash=hash, 
> > path=path)
> >
> 
> I think the problem is not a bad tag, but a bad message-id. The last
> line of output before the UnicodeWarning and the broken pipe is
> 
> building a quoted path for 
> u'D1B4DEBCAFFC4A05A4D4349A6EC5C9D8@\xd1\xe5\xf0\xe3\xe5\xe9-\xcf\xca' / 
> u'unread'

  $ ln -s nmbug nmbug.py
  $ python2 -W error -c "import nmbug; 
nmbug._hex_quote(u'D1B4DEBCAFFC4A05A4D4349A6EC5C9D8@\xd1\xe5\xf0\xe3\xe5\xe9-\xcf\xca')"
  Traceback (most recent call last):
File "", line 1, in 
File "nmbug.py", line 106, in _hex_quote
  uppercase_escapes = _quote(string, safe)
File "/usr/lib64/python2.7/urllib.py", line 1303, in quote
  return ''.join(map(quoter, s))
  UnicodeWarning: Unicode equal comparison failed to convert both arguments to 
Unicode - interpreting them as being unequal

The problem seems to be having Unicode characters in either quote argument:

  $ python2 -W error -c "import urllib; 
urllib.quote(u'D1B4DEBCAFFC4A05A4D4349A6EC5C9D8@\xd1\xe5\xf0\xe3\xe5\xe9-\xcf\xca')"
  …
  UnicodeWarning: Unicode equal comparison failed to convert both arguments to 
Unicode - interpreting them as being unequal
  $ python2 -W error -c "import urllib; 
urllib.quote(u'D1B4DEBCAFFC4A05A4D4349A6EC5C9D8@\xd1\xe5\xf0\xe3\xe5\xe9-\xcf\xca',
 u'+@=:,')"
  …
  UnicodeWarning: Unicode equal comparison failed to convert both arguments to 
Unicode - interpreting them as being unequal
  $ python2 -W error -c "import urllib; 
urllib.quote(u'D1B4DEBCAFFC4A05A4D4349A6EC5C9D8@\xd1\xe5\xf0\xe3\xe5\xe9-\xcf\xca'.encode('utf-8'),
 u'+@=:,')"
  …
  UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 33: 
ordinal not in range(128)
  $ python2 -W error -c "import urllib; 
print(urllib.quote(u'D1B4DEBCAFFC4A05A4D4349A6EC5C9D8@\xd1\xe5\xf0\xe3\xe5\xe9-\xcf\xca'.encode('utf-8'),
 u'+@=:,'.encode('utf-8')))"
  
D1B4DEBCAFFC4A05A4D4349A6EC5C9D8@%C3%91%C3%A5%C3%B0%C3%A3%C3%A5%C3%A9-%C3%8F%C3%8A

Related Python issues [1,2,3,4,5].  [2] lead to the currently working
Python 3 implementation, which encodes to UTF-8 by default and has an
‘encoding’ option [6].  There's some useful background in [7].  For
compatibility with Python 3, I suggest patching _hex_quote to take an
encoding option, defaulting to UTF-8, and encoding both strings that
are passed to _quote.  We should probably raise a ValueError if the
length of the encoded safe characters doesn't match the length of the
Unicode safe characters, because the caller will probably not expect
the byte-level quoting that would cause.  Python 3 covers that by
restricting the safe characters to ASCII [6], although passing
non-ASCII characters with safe doesn't seem to raise an exception:

  $ python3 -c "from urllib.parse import quote; print(quote('\u0091', 
'\u0091'))"
  %C2%91
  $ python3 -c "from urllib.parse import quote; print(quote('\u203b', 
'\u203b'))"
  %E2%80%BB

Anyhow, I'll file a patch adding UTF-8 encoding so Python 2 works like
Python 3.

Cheers,
Trevor

[1]: http://bugs.python.org/issue2637
[2]: http://bugs.python.org/issue3300
[3]: http://bugs.python.org/issue22231
[4]: http://bugs.python.org/issue23885
[5]: http://bugs.python.org/issue1712522
[6]: https://docs.python.org/3/library/urllib.parse.html#urllib.parse.quote
[7]: https://mail.python.org/pipermail/python-dev/2006-July/067335.html

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: problems with nmbug and empty prefix (UnicodeWarning and broken pipe)

2016-02-13 Thread W. Trevor King
On Sat, Feb 13, 2016 at 10:41:40PM -0400, David Bremner wrote:
> Traceback (most recent call last):
>   File "/home/bremner/.config/scripts/nmbug.real", line 834, in 
> args.func(**kwargs)
>   File "/home/bremner/.config/scripts/nmbug.real", line 324, in commit
> status = get_status()
>   File "/home/bremner/.config/scripts/nmbug.real", line 581, in get_status
> index = _index_tags()
>   File "/home/bremner/.config/scripts/nmbug.real", line 621, in _index_tags
> git.stdin.write(line)

This traceback is pointing at what should be a stream write, so I
don't see how urllib is involved there at all.  I guess this traceback
ends up in the “Broken pipe” message from your original post?

Dropping some debugging prints into the:

  for line in notmuch.stdout:

block will likely get us close enough to figure out which line in the
‘notmuch dump …’ output causing the problem.

> > We only call ‘notmuch dump …’ from _index_tags, where dump's stdout is
> > tweaked and fed into ‘git update-index …’.  Your urllib UnicodeWarning
> > suggests the issue lies in:
> >
> >   tags = [
> >   _unquote(tag[len(prefix):])
> >   for tag in tags_string.split()
> >   if tag.startswith(prefix)]
> 
> Looking at the source for urllib, that line is actually in quote,
> which is called only from _hex_quote

And we call _hex_quote from _index_tags_for_message, which is right
before the git.stdin.write line from your traceback.  So its certainly
possible that we're feeding _hex_quote something it can't handle in
Python 2.  If I could reproduce this locally, I'd probably drop a
debugging print in there as well:

  for tag in tags:
  _LOG.debug('building a quoted path for {!r} / {!r}'.format(id, tag))
  path = 'tags/{id}/{tag}'.format(
  id=_hex_quote(string=id), tag=_hex_quote(string=tag))
  yield '{mode} {hash}\t{path}\n'.format(mode=mode, hash=hash, path=path)

> Unfortunately despite my best efforts with filterwarnings, I
> couldn't figure out how to get a stack trace for that
> UnicodeWarning.

I haven't spent much time with filterwarnings.  My guess is that:

  $ python -W error ./nmbug --log-level debug commit

will turn it into a raised exception [1].  But you may have tried
that, and it may not have worked for some reason :p.

If dropping debugging prints into the relevant code sections doesn't
turn up the problem, ‘strace -o /tmp/trace -f nmbug --log-level debug
commit’ will likely capture enough of the data moving between
processes for us to figure out what nmbug is choking on.

Another alternative would be to check your list of censored tags for
anything that looks like it might contain Unicode-issue-triggering
characters.  What is your locale?  Do you have any tags with non-ASCII
characters?  You should be able to isolate this problem by iterating
through all your tags:

  $ for TAG in 
  > do
  >   echo "${TAG}"
  >   NMBPREFIX="${TAG%?}" nmbug commit
  > done

and see which one acts up.

Cheers,
Trevor

[1]: https://docs.python.org/2/library/warnings.html#warning-filter

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test/README: have matching test script file names

2016-02-12 Thread W. Trevor King
On Fri, Feb 12, 2016 at 09:17:00PM +0200, Tomi Ollila wrote:
> +The test system itself requires:
> +
> +  - bash(1) version 4.0 or newer
> +
> +Without bash 4.0+ the tests just refuse to run.

This was surprising to me (obviously I haven't looked at the test
library closely ;), because Git tries to maintain compatiblity with
POSIX [1] and Git is the source of notmuch's test framework [2].  But
it looks like notmuch's fork of the test framework was Bash-specific
from 0d67c52f (notmuch-test: Use named-parameters for generate_message
function, 2010-02-03).  That commit happened before the Git framework,
but we still have the code it added:

# This is our (bash-specific) magic for doing named parameters  

  
local -A template="($@)"

Carl explicitly motivated the change in his commit message.  +1 to
documenting the requirement explicitly in the README, although users
should have been getting nice error messages since 20018a0c (test:
Emit a friendly error message if run with bash < 4.0, 2010-10-28).

Cheers,
Trevor

[1]: 
https://git.kernel.org/cgit/git/git.git/tree/Documentation/CodingGuidelines?h=v2.7.1
[2]: 0083854 (Copy test framework from Git, 2010-06-10)

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: nmbug in the Debian packages?

2016-02-08 Thread W. Trevor King
On Mon, Feb 08, 2016 at 07:33:10AM -0400, David Bremner wrote:
> We can include it in /usr/bin along and install a proper man page…

I'm happy to write up a man page.  Do you want it in a separate
directory from nmbug-status / notmuch-report [1]?  Do you want to
rename nmbug to something notmuch-* namespaced?

Cheers,
Trevor

[1]: id:20160206205030.gh11...@odin.tremily.us

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Binding access to ~/.notmuch-config

2016-01-13 Thread W. Trevor King
On Wed, Jan 13, 2016 at 08:25:10AM -0400, David Bremner wrote:
> Konrad Hinsen writes:
> > I agree. I see notmuch as a collection of CLI tools, some of which
> > are part of the distribution and others are written by myself for
> > my specific needs. I'd like them all to share a single
> > configuration file.  In fact, I'd love to be able to add sections
> > specific to my Python scripts.
> 
> Yes, I understand that it's convenient, but the current set up is
> not really very robust…  In particular upcoming changes may move
> some configuration items out of this file and into a library level
> configuration API.

I think you mean [1].  And that's fine, since Python scripts, etc.,
can use that API to set and access config settings, be they standard
or script-specific (as far as I can tell, I haven't reviewed that
series in detail).  Docs on any standard settings would be nice, but I
guess they'd land as features moved out of ~/.notmuch-config and into
the database.  The only setting that can't move into the database (as
you pointed out earlier [2]) is the path to the database.  That's
currently all the Python bindings extract now, and making that route
the officially blessed way to find the default database path makes
sense to me.

Cheers,
Trevor

[1]: id:1452654610-22864-1-git-send-email-da...@tethera.net
 http://thread.gmane.org/gmane.mail.notmuch.general/21643
[2]: id:8760yy4o3w@tesseract.cs.unb.ca
 http://article.gmane.org/gmane.mail.notmuch.general/21639

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Crash with Python bindings

2016-01-12 Thread W. Trevor King
On Tue, Jan 12, 2016 at 03:23:46PM +0100, Konrad Hinsen wrote:
> Hi Justus,
> 
> > So I guess what happens is that Python3 changed how the
> > interpreter environment is torn down and they actually destroy the
> > 'q' object.  If that is so, then your data is indeed safe.
> 
> That reminds me of a recent change in object finalization in Python
> 3:
> 
>   https://www.python.org/dev/peps/pep-0442/

I'm pretty sure that is what's going on.  The PEP landed in Python
3.4, explaining why I don't see this issue in 3.3 [1].  And it has
[2]:

   In particular, this PEP obsoletes the current guideline that
   "objects with a __del__ method should not be part of a reference
   cycle".

I'm not sure what the best way is to fix __del__ in our Python
bindings, but if you manage them explicitly:

  db = Database()
  q = Query(db, "*")
  del q
  db.close()
  del db

you can avoid the abort (which happens when q.__del__ is called after
db.__del__).  We could make that sort of cleanup easier with context
managers for Query objects (we have them for databases since [3]), and
they look like the only object that keep an internal database
reference:

  with Database() as db:
with Query(db, "*") as q:
  # do something with q
db.close()

Cheers,
Trevor

[1]: id:20160112180813.ga20...@odin.tremily.us
[2]: https://www.python.org/dev/peps/pep-0442/#impact
[3]: 36ce7e3c (python: implement the context manager protocol for
 database objects, 2012-02-15, v0.12)

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Crash with Python bindings

2016-01-12 Thread W. Trevor King
On Tue, Jan 12, 2016 at 10:41:57AM +0100, Konrad Hinsen wrote:
> --
> from notmuch import Query, Database
> 
> def foo(bar):
>  pass
> 
> db = Database()
> q = Query(db, "*")
> db.close()
> --
> 
> Running this script (Python 3.5, MacOS X) yields:
>
> [1]22478 abort  pydev3 Temp/notmuch_test.py
> …
> The strange part is that what causes the crash is the presence of the 
> function foo(), even though it is never called. Remove foo and the 
> script runs fine. It is also necessary to create a Query object.

Adding some more data-points, I see the same results with Python 3.4.3
on Gentoo, although stderr just gets “Aborted”.  All permutations seem
to work on Python 3.3.5.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Binding access to ~/.notmuch-config (was: Crash with Python bindings)

2016-01-12 Thread W. Trevor King
On Tue, Jan 12, 2016 at 03:03:15PM -0400, David Bremner wrote:
> Nothing to do with Konrad's crash, but I consider the fact that the
> python bindings read ~/.notmuch-config to be a kind of layering
> violation, since that file belongs to the CLI, while the bindings
> are supposed to provide access to libnotmuch.

I think of ~/.notmuch-config as being shared between all client code,
and in that view it makes sense to have both the CLI and Python
bindings (and other bindings) access it to figure out how to configure
their library access calls.  Having a separate config file for each
client to point at the default database path seems like more trouble
than it's worth, as does adding a library function for “reach into
some local config and return the default database path”.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] nmbug-status: Style headers with smaller fonts

2016-01-07 Thread W. Trevor King
We only use h1 through h3, and David prefers smaller headers [1], so
shift over to the font sizes usually used for h2 through h4 [2,3,4].
I haven't bothered with the W3C's default margins, since a bit of
extra whitespace doesn't seem like a big deal.

[1]: id:87k2nl8r0k.fsf at zancas.localnet
 http://article.gmane.org/gmane.mail.notmuch.general/21595
[2]: http://www.w3.org/TR/html-markup/h2.html
[3]: http://www.w3.org/TR/html-markup/h3.html
[4]: http://www.w3.org/TR/html-markup/h4.html
---
On Thu, Jan 07, 2016 at 09:20:59AM -0400, David Bremner wrote:
> W. Trevor King writes:
> > We can always add additional CSS if the default h1 formatting is
> > too intense.
>
> I'm pretty sure it will be, at least for me, since that's the reason
> I did it this way in the first place. I'm (obviously) not a web
> person, how about providing some CSS to roughly duplicate the
> current visuals?

Here you go :).

Cheers,
Trevor

 devel/nmbug/nmbug-status | 9 +
 1 file changed, 9 insertions(+)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index f33f660..0382919 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -327,6 +327,15 @@ header_template = config['meta'].get('header', 
'''
   
   {title}
   

[PATCH 1/5] nmbug-status: Avoid hard-coded filename in error message

2016-01-01 Thread W. Trevor King
We already have a 'filename' variable with the name, so stay DRY and
use that variable here.

Also fix a missing-whitespace error from bed8b674 (nmbug-status:
Clarify errors for illegible configs, 2014-05-10), wrapping on the
sentence to match similar error-generation earlier in this function.
---
 devel/nmbug/nmbug-status | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index b36b6ad..22e3b5b 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -109,9 +109,9 @@ def read_config(path=None, encoding=None):
 status = p.wait()
 if status != 0:
 raise ConfigError(
-("Missing status-config.json in branch '{branch}' of"
- '{nmbgit}.  Add the file or explicitly set --config.'
-).format(branch=branch, nmbgit=nmbhome))
+("Missing {filename} in branch '{branch}' of {nmbgit}.  "
+ 'Add the file or explicitly set --config.'
+).format(filename=filename, branch=branch, nmbgit=nmbhome))
 
 config_json = config_bytes.decode(encoding)
 try:
-- 
2.1.0.60.g85f0837

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


[PATCH 4/5] notmuch-report: Add notmuch-report(1) and notmuch-report.json(5) man pages

2016-01-01 Thread W. Trevor King
To describe the script and config file format, so folks don't have to
dig through NEWS or the script's source to get that information.

The Makefile and conf.py are excerpted from the main doc/ directory
with minor simplifications and adjustments.  The devel/nmbug/ scripts
are largely independent of notmuch, and separating the docs here
allows packagers to easily build the docs and install the scripts in a
separate package, without complicating notmuch's core build/install
process.
---
 devel/nmbug/doc/.gitignore |   2 +
 devel/nmbug/doc/Makefile   |  38 
 devel/nmbug/doc/conf.py|  67 +
 devel/nmbug/doc/index.rst  |  17 
 devel/nmbug/doc/man1/notmuch-report.1.rst  |  54 +++
 devel/nmbug/doc/man5/notmuch-report.json.5.rst | 129 +
 devel/nmbug/notmuch-report |  19 ++--
 7 files changed, 318 insertions(+), 8 deletions(-)
 create mode 100644 devel/nmbug/doc/.gitignore
 create mode 100644 devel/nmbug/doc/Makefile
 create mode 100644 devel/nmbug/doc/conf.py
 create mode 100644 devel/nmbug/doc/index.rst
 create mode 100644 devel/nmbug/doc/man1/notmuch-report.1.rst
 create mode 100644 devel/nmbug/doc/man5/notmuch-report.json.5.rst

diff --git a/devel/nmbug/doc/.gitignore b/devel/nmbug/doc/.gitignore
new file mode 100644
index 000..4930881
--- /dev/null
+++ b/devel/nmbug/doc/.gitignore
@@ -0,0 +1,2 @@
+*.pyc
+_build
diff --git a/devel/nmbug/doc/Makefile b/devel/nmbug/doc/Makefile
new file mode 100644
index 000..7ea3ae7
--- /dev/null
+++ b/devel/nmbug/doc/Makefile
@@ -0,0 +1,38 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS=
+SPHINXBUILD   = sphinx-build
+DOCBUILDDIR   := _build
+
+SRCDIR ?= .
+ALLSPHINXOPTS := -d $(DOCBUILDDIR)/doctrees $(SPHINXOPTS) $(SRCDIR)
+
+MAN_RST_FILES := $(shell find $(SRCDIR)/man* -name '*.rst')
+MAN_ROFF_FILES := $(patsubst 
$(SRCDIR)/man%.rst,$(DOCBUILDDIR)/man/man%,$(MAN_RST_FILES))
+MAN_GZIP_FILES := $(addsuffix .gz,$(MAN_ROFF_FILES))
+
+.PHONY: build-man
+build-man: $(MAN_GZIP_FILES)
+
+%.gz: %
+   rm -f $@ && gzip --stdout $^ > $@
+
+$(MAN_ROFF_FILES): $(DOCBUILDDIR)/.roff.stamp
+
+# By using $(DOCBUILDDIR)/.roff.stamp instead of $(MAN_ROFF_FILES), we
+# convey to make that a single invocation of this recipe builds all
+# of the roff files.  This prevents parallel make from starting an
+# instance of this recipe for each roff file.
+$(DOCBUILDDIR)/.roff.stamp $(MAN_ROFF_FILES): $(MAN_RST_FILES)
+   mkdir -p $(DOCBUILDDIR)
+   touch $(DOCBUILDDIR)/.roff.stamp
+   $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(DOCBUILDDIR)/man
+   for section in 1 5; do \
+   mkdir -p $(DOCBUILDDIR)/man/man$${section}; \
+   mv $(DOCBUILDDIR)/man/*.$${section} 
$(DOCBUILDDIR)/man/man$${section}; \
+   done
+
+clean:
+   rm -rf $(DOCBUILDDIR) $(SRCDIR)/conf.pyc
diff --git a/devel/nmbug/doc/conf.py b/devel/nmbug/doc/conf.py
new file mode 100644
index 000..29379d0
--- /dev/null
+++ b/devel/nmbug/doc/conf.py
@@ -0,0 +1,67 @@
+# -*- coding: utf-8 -*-
+
+import os.path
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = 'notmuch'
+authors = 'Carl Worth and many others'
+copyright = '2009-2015, {0}'.format(authors)
+
+location = os.path.dirname(__file__)
+
+dirname = location
+while True:
+version_file = os.path.join(dirname, 'version')
+if os.path.exists(version_file):
+with open(version_file,'r') as f:
+version = f.read().strip()
+break
+if dirname == '/':
+raise ValueError(
+'no version file found in this directory or its ancestors')
+dirname = os.path.dirname(dirname)
+
+# The full version, including alpha/beta/rc tags.
+release = version
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# -- Options for manual page output ---
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+
+man_pages = [
+('man1/notmuch-report.1', 'notmuch-report',
+ 'generate reports from notmuch queries', [authors], 1),
+('man5/notmuch-report.json.5', 'notmuch-report.json',
+ 'configure notmuch-report', [authors], 5),
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+# -- Options for Texinfo output ---
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+#  dir menu entry, description, category)
+# If true, do not generate a @detailmenu in the "Top" node's menu.
+texinfo_no_detailmenu = True
+

[PATCH 2/5] notmuch-report: Rename from nmbug-status

2016-01-01 Thread W. Trevor King
This script generates reports based on notmuch queries, and doesn't
really have anything to do with nmbug, except for sharing the NMBGIT
environment variable.
---
 devel/nmbug/nmbug-status   | 419 -
 devel/nmbug/notmuch-report | 419 +
 2 files changed, 419 insertions(+), 419 deletions(-)
 delete mode 100755 devel/nmbug/nmbug-status
 create mode 100755 devel/nmbug/notmuch-report

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
deleted file mode 100755
index 22e3b5b..000
--- a/devel/nmbug/nmbug-status
+++ /dev/null
@@ -1,419 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (c) 2011-2012 David Bremner 
-#
-# dependencies
-#   - python 2.6 for json
-#   - argparse; either python 2.7, or install separately
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see http://www.gnu.org/licenses/ .
-
-"""Generate HTML for one or more notmuch searches.
-
-Messages matching each search are grouped by thread.  Each message
-that contains both a subject and message-id will have the displayed
-subject link to the Gmane view of the message.
-"""
-
-from __future__ import print_function
-from __future__ import unicode_literals
-
-import codecs
-import collections
-import datetime
-import email.utils
-try:  # Python 3
-from urllib.parse import quote
-except ImportError:  # Python 2
-from urllib import quote
-import json
-import argparse
-import os
-import re
-import sys
-import subprocess
-import xml.sax.saxutils
-
-
-_ENCODING = 'UTF-8'
-_PAGES = {}
-
-
-if not hasattr(collections, 'OrderedDict'):  # Python 2.6 or earlier
-class _OrderedDict (dict):
-"Just enough of a stub to get through Page._get_threads"
-def __init__(self, *args, **kwargs):
-super(_OrderedDict, self).__init__(*args, **kwargs)
-self._keys = []  # record key order
-
-def __setitem__(self, key, value):
-super(_OrderedDict, self).__setitem__(key, value)
-self._keys.append(key)
-
-def values(self):
-for key in self._keys:
-yield self[key]
-
-
-collections.OrderedDict = _OrderedDict
-
-
-class ConfigError (Exception):
-"""Errors with config file usage
-"""
-pass
-
-
-def read_config(path=None, encoding=None):
-"Read config from json file"
-if not encoding:
-encoding = _ENCODING
-if path:
-try:
-with open(path, 'rb') as f:
-config_bytes = f.read()
-except IOError as e:
-raise ConfigError('Could not read config from {}'.format(path))
-else:
-nmbhome = os.getenv('NMBGIT', os.path.expanduser('~/.nmbug'))
-branch = 'config'
-filename = 'status-config.json'
-
-# read only the first line from the pipe
-sha1_bytes = subprocess.Popen(
-['git', '--git-dir', nmbhome, 'show-ref', '-s', '--heads', branch],
-stdout=subprocess.PIPE).stdout.readline()
-sha1 = sha1_bytes.decode(encoding).rstrip()
-if not sha1:
-raise ConfigError(
-("No local branch '{branch}' in {nmbgit}.  "
- 'Checkout a local {branch} branch or explicitly set --config.'
-).format(branch=branch, nmbgit=nmbhome))
-
-p = subprocess.Popen(
-['git', '--git-dir', nmbhome, 'cat-file', 'blob',
- '{}:{}'.format(sha1, filename)],
-stdout=subprocess.PIPE)
-config_bytes, err = p.communicate()
-status = p.wait()
-if status != 0:
-raise ConfigError(
-("Missing {filename} in branch '{branch}' of {nmbgit}.  "
- 'Add the file or explicitly set --config.'
-).format(filename=filename, branch=branch, nmbgit=nmbhome))
-
-config_json = config_bytes.decode(encoding)
-try:
-return json.loads(config_json)
-except ValueError as e:
-if not path:
-path = "{} in branch '{}' of {}".format(
-filename, branch, nmbhome)
-raise ConfigError(
-'Could not parse JSON from the config file {}:\n{}'.format(
-path, e))
-
-
-class Thread (list):
-def __init__(self):
-self.running_data = {}
-
-
-class Page (object):
-def __init__(self, header=None, footer=None):
-self.header = header
- 

[PATCH v2 3/4] nmbug-status: Wrap query phrases in parentheses when and-ing together

2016-01-01 Thread W. Trevor King
For example:

  "query": ["tag:a", "tag:b or tag:c"]

is now converted to:

  ( tag:a ) and ( tag:b or tag:c )

instead of the old:

  tag:a and tag:b or tag:c

This helps us avoid confusion due to Xapian's higher-precedence AND
[1], where the old query would be interpreted as:

  ( tag:a and tag:b ) or tag:c

[1]: http://xapian.org/docs/queryparser.html
---
 NEWS | 3 +++
 devel/nmbug/nmbug-status | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 9f2e860..403a046 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ Notmuch 0.22 (UNRELEASED)
 nmbug-status
 
 
+`nmbug-status` now wraps query phrases in parentheses when and-ing
+them together, to avoid confusion about clause grouping.
+
 `nmbug-status` now supports `meta.message-url` to override the Gmane
 template.  For example, you can use:
 
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index d72f1db..7d3a76e 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -167,7 +167,8 @@ class Page (object):
 view['title'], sort_key))
 if 'query-string' not in view:
 query = view['query']
-view['query-string'] = ' and '.join(query)
+view['query-string'] = ' and '.join(
+'( {} )'.format(q) for q in query)
 q = notmuch.Query(database, view['query-string'])
 q.set_sort(sort)
 threads = self._get_threads(messages=q.search_messages())
@@ -411,7 +412,7 @@ if args.list_views:
 elif args.get_query != None:
 for view in config['views']:
 if args.get_query == view['title']:
-print(' and '.join(view['query']))
+print(' and '.join('( {} )'.format(q) for q in view['query']))
 sys.exit(0)
 else:
 # only import notmuch if needed
-- 
2.1.0.60.g85f0837

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


[PATCH 5/5] NEWS: Document the notmuch-report branch

2016-01-01 Thread W. Trevor King
---
 NEWS | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/NEWS b/NEWS
index 6681699..3535614 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,29 @@
+Notmuch 0.22 (UNRELEASED)
+=
+
+Documentation
+-
+
+New `notmuch-report(1)` and `notmuch-report.json(5)` man pages
+describe `notmuch-report` and its JSON configuration file.  You can
+build these files by running `make` in the `devel/nmbug/doc`
+directory.
+
+notmuch-report
+--
+
+Renamed from `nmbug-status`.  This script generates reports based on
+notmuch queries, and doesn't really have anything to do with nmbug,
+except for sharing the `NMBGIT` environment variable.  The new name
+focuses on the script's action, instead of its historical association
+with the nmbug workflow.  This should make it more discoverable for
+users looking for generic notmuch reporting tools.
+
+The default configuration file name (extracted from the `config`
+branch of `NBMGIT` has changed from `status-config.json` to
+`notmuch-report.json` so it is more obviously associated with the
+report-generating script.
+
 Notmuch 0.21 (2015-10-29)
 =
 
-- 
2.1.0.60.g85f0837

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


[PATCH v2 2/4] nmbug-status: Add meta.message-url config setting

2016-01-01 Thread W. Trevor King
So you can link to archives other than Gmane.  For example, I'm doing
this in [1].

[1]: https://github.com/wking/nmbug-oci
---
 NEWS | 20 
 devel/nmbug/nmbug-status | 13 ++---
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 0a7a0e0..9f2e860 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,23 @@
+Notmuch 0.22 (UNRELEASED)
+=
+
+nmbug-status
+
+
+`nmbug-status` now supports `meta.message-url` to override the Gmane
+template.  For example, you can use:
+
+{
+  "meta": {
+"message-url": 
"https://groups.google.com/a/opencontainers.org/forum/#!search/messageid$3A%22{message-id}%22;
+ ...
+  },
+  ...
+}
+
+To link to messages in the [opencontainers.org Google
+Groups](https://groups.google.com/a/opencontainers.org/forum/#!overview).
+
 Notmuch 0.21 (2015-10-29)
 =
 
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index b36b6ad..d72f1db 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -19,11 +19,11 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see http://www.gnu.org/licenses/ .
 
-"""Generate HTML for one or more notmuch searches.
+"""Generate text and/or HTML for one or more notmuch searches.
 
 Messages matching each search are grouped by thread.  Each message
 that contains both a subject and message-id will have the displayed
-subject link to the Gmane view of the message.
+subject link to an archive view of the message (defaulting to Gmane).
 """
 
 from __future__ import print_function
@@ -232,6 +232,10 @@ class Page (object):
 class HtmlPage (Page):
 _slug_regexp = re.compile('\W+')
 
+def __init__(self, message_url_template, **kwargs):
+self.message_url_template = message_url_template
+super(HtmlPage, self).__init__(**kwargs)
+
 def _write_header(self, views, stream):
 super(HtmlPage, self)._write_header(views=views, stream=stream)
 stream.write('\n')
@@ -292,8 +296,9 @@ class HtmlPage (Page):
 'message-id': quote(display_data['message-id']),
 'subject': xml.sax.saxutils.escape(display_data['subject']),
 }
+d['url'] = self.message_url_template.format(**d)
 display_data['subject'] = (
-'http://mid.gmane.org/{message-id};>{subject}'
+'{subject}'
 ).format(**d)
 for key in ['message-id', 'from']:
 if key in display_data:
@@ -395,6 +400,8 @@ _PAGES['text'] = Page()
 _PAGES['html'] = HtmlPage(
 header=header_template.format(**context),
 footer=footer_template.format(**context),
+message_url_template=config['meta'].get(
+'message-url', 'http://mid.gmane.org/{message-id}'),
 )
 
 if args.list_views:
-- 
2.1.0.60.g85f0837

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


[PATCH v2 4/4] status-config.json: Remove parens from query entry

2016-01-01 Thread W. Trevor King
These are now added by nmbug-status.
---
 devel/nmbug/status-config.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devel/nmbug/status-config.json b/devel/nmbug/status-config.json
index b926946..48b6f19 100644
--- a/devel/nmbug/status-config.json
+++ b/devel/nmbug/status-config.json
@@ -62,7 +62,7 @@
"not tag:notmuch::obsolete",
"not tag:notmuch::stale",
"not tag:notmuch::wontfix",
-   "(tag:notmuch::moreinfo or tag:notmuch::needs-review)"
+   "tag:notmuch::moreinfo or tag:notmuch::needs-review"
],
"title": "Review"
}
-- 
2.1.0.60.g85f0837

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


[PATCH 3/5] notmuch-report.json: Rename from status-config.json

2016-01-01 Thread W. Trevor King
status-config.json wasn't obviously associated with the old
nmubg-status, now notmuch-report.  The new name is
${CONFIGURED_SCRIPT}.json, so the association should be clear.
---
 devel/nmbug/notmuch-report  |  2 +-
 devel/nmbug/notmuch-report.json | 70 +
 devel/nmbug/status-config.json  | 70 -
 3 files changed, 71 insertions(+), 71 deletions(-)
 create mode 100644 devel/nmbug/notmuch-report.json
 delete mode 100644 devel/nmbug/status-config.json

diff --git a/devel/nmbug/notmuch-report b/devel/nmbug/notmuch-report
index 22e3b5b..5425e06 100755
--- a/devel/nmbug/notmuch-report
+++ b/devel/nmbug/notmuch-report
@@ -88,7 +88,7 @@ def read_config(path=None, encoding=None):
 else:
 nmbhome = os.getenv('NMBGIT', os.path.expanduser('~/.nmbug'))
 branch = 'config'
-filename = 'status-config.json'
+filename = 'notmuch-report.json'
 
 # read only the first line from the pipe
 sha1_bytes = subprocess.Popen(
diff --git a/devel/nmbug/notmuch-report.json b/devel/nmbug/notmuch-report.json
new file mode 100644
index 000..b926946
--- /dev/null
+++ b/devel/nmbug/notmuch-report.json
@@ -0,0 +1,70 @@
+{
+"meta": {
+"title": "Notmuch Patches",
+"blurb": "For more information see http://notmuchmail.org/nmbug\;>nmbug"
+},
+
+"views": [
+   {
+   "comment": "Unresolved bugs (or just need tag updating).",
+   "query": [
+   "tag:notmuch::bug",
+   "not tag:notmuch::fixed",
+   "not tag:notmuch::wontfix"
+   ],
+   "title": "Bugs"
+   },
+   {
+   "comment": "These patches are under consideration for pushing.",
+   "query": [
+   "tag:notmuch::patch and not tag:notmuch::pushed",
+   "not tag:notmuch::obsolete and not tag:notmuch::wip",
+   "not tag:notmuch::stale and not tag:notmuch::contrib",
+   "not tag:notmuch::moreinfo",
+   "not tag:notmuch::python",
+   "not tag:notmuch::vim",
+   "not tag:notmuch::wontfix",
+   "not tag:notmuch::needs-review"
+   ],
+   "title": "Maybe Ready (Core and Emacs)"
+   },
+   {
+   "comment": "These python related patches might be ready to push, or 
they might just need updated tags.",
+   "query": [
+   "tag:notmuch::patch and not tag:notmuch::pushed",
+   "not tag:notmuch::obsolete and not tag:notmuch::wip",
+   "not tag:notmuch::stale and not tag:notmuch::contrib",
+   "not tag:notmuch::moreinfo",
+   "not tag:notmuch::wontfix",
+   " tag:notmuch::python",
+   "not tag:notmuch::needs-review"
+   ],
+   "title": "Maybe Ready (Python)"
+   },
+   {
+   "comment": "These vim related patches might be ready to push, or 
they might just need updated tags.",
+   "query": [
+   "tag:notmuch::patch and not tag:notmuch::pushed",
+   "not tag:notmuch::obsolete and not tag:notmuch::wip",
+   "not tag:notmuch::stale and not tag:notmuch::contrib",
+   "not tag:notmuch::moreinfo",
+   "not tag:notmuch::wontfix",
+   "tag:notmuch::vim",
+   "not tag:notmuch::needs-review"
+   ],
+   "title": "Maybe Ready (vim)"
+   },
+   {
+   "comment": "These patches are under review, or waiting for 
feedback.",
+   "query": [
+   "tag:notmuch::patch",
+   "not tag:notmuch::pushed",
+   "not tag:notmuch::obsolete",
+   "not tag:notmuch::stale",
+   "not tag:notmuch::wontfix",
+   "(tag:notmuch::moreinfo or tag:notmuch::needs-review)"
+   ],
+   "title": "Review"
+   }
+]
+}
diff --git a/devel/nmbug/status-config.json b/devel/nmbug/status-config.json
deleted file mode 100644
index b926946..000
--- a/devel/nmbug/status-config.json
+++ /dev/null
@@ -1,70 +0,0 @@
-{
-"meta": {
-"title": "Notmuch Patches",
-"blurb": "For more information see http://notmuchmail.org/nmbug\;>nmbug"
-},
-
-"views": [
-   {
-   "comment": "Unresolved bugs (or just need tag updating).",
-   "query": [
-   "tag:notmuch::bug",
-   "not tag:notmuch::fixed",
-   "not tag:notmuch::wontfix"
-   ],
-   "title": "Bugs"
-   },
-   {
-   "comment": "These patches are under consideration for pushing.",
-   "query": [
-   "tag:notmuch::patch and not tag:notmuch::pushed",
-   "not tag:notmuch::obsolete and not tag:notmuch::wip",
-   "not tag:notmuch::stale and not tag:notmuch::contrib",
-   "not tag:notmuch::moreinfo",
-   "not tag:notmuch::python",

[PATCH 0/5] notmuch-report: Rename from nmbug-status and add man pages

2016-01-01 Thread W. Trevor King
Spun off from discussion here [1].  I've just shifted nmbug-status in
this series, and left nmbug alone for now.  If/when this series lands,
it will be easy to handle a nmbug rename in a subsequent series.

Note that while I think the renames from nmbug-status to
notmuch-report and status-config.json to notmuch-report.json are
useful changes, they will break backwards compatibility for existing
users.  I'm not sure how many existing users there are, and I expect
the NEWS entry will clue them in.  But if folks want a temporary
fallback to status-config.json in the absence of notmuch-report.json,
I can add that in a v2.

Cheers,
Trevor

[1]: id:m2twmxbl1i@guru.guru-group.fi
 http://thread.gmane.org/gmane.mail.notmuch.general/21535/focus=21539

W. Trevor King (5):
  nmbug-status: Avoid hard-coded filename in error message
  notmuch-report: Rename from nmbug-status
  notmuch-report.json: Rename from status-config.json
  notmuch-report: Add notmuch-report(1) and notmuch-report.json(5) man
pages
  NEWS: Document the notmuch-report branch

 NEWS   |  26 ++
 devel/nmbug/doc/.gitignore |   2 +
 devel/nmbug/doc/Makefile   |  38 +++
 devel/nmbug/doc/conf.py|  67 
 devel/nmbug/doc/index.rst  |  17 +
 devel/nmbug/doc/man1/notmuch-report.1.rst  |  54 
 devel/nmbug/doc/man5/notmuch-report.json.5.rst | 129 
 devel/nmbug/nmbug-status   | 419 
 devel/nmbug/notmuch-report | 422 +
 devel/nmbug/notmuch-report.json|  70 
 devel/nmbug/status-config.json |  70 
 11 files changed, 825 insertions(+), 489 deletions(-)
 create mode 100644 devel/nmbug/doc/.gitignore
 create mode 100644 devel/nmbug/doc/Makefile
 create mode 100644 devel/nmbug/doc/conf.py
 create mode 100644 devel/nmbug/doc/index.rst
 create mode 100644 devel/nmbug/doc/man1/notmuch-report.1.rst
 create mode 100644 devel/nmbug/doc/man5/notmuch-report.json.5.rst
 delete mode 100755 devel/nmbug/nmbug-status
 create mode 100755 devel/nmbug/notmuch-report
 create mode 100644 devel/nmbug/notmuch-report.json
 delete mode 100644 devel/nmbug/status-config.json

-- 
2.1.0.60.g85f0837

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


[PATCH v2 0/4] nmbug-status: meta.message-url and query parens

2016-01-01 Thread W. Trevor King
Changes since v1 [1]:

* [4/5, v2 3/4] Added parentheses handling for ‘nmbug-status
  --get-query VIEW’ too [2].
* [3/5] Dropped the man page, and will file a separate series that
  adds man pages to the script directory [3].

Cheers,
Trevor

[1]: id:cover.1451502495.git.wk...@tremily.us
 http://thread.gmane.org/gmane.mail.notmuch.general/21523
 http://thread.gmane.org/gmane.mail.notmuch.general/21535
[2]: id:20151231164719.ga20...@odin.tremily.us
 http://thread.gmane.org/gmane.mail.notmuch.general/21523/focus=21534

W. Trevor King (4):
  NEWS: Remove trailing comma from an old nmbug-status config
  nmbug-status: Add meta.message-url config setting
  nmbug-status: Wrap query phrases in parentheses when and-ing together
  status-config.json: Remove parens from query entry

 NEWS   | 25 -
 devel/nmbug/nmbug-status   | 18 +-
 devel/nmbug/status-config.json |  2 +-
 3 files changed, 38 insertions(+), 7 deletions(-)

-- 
2.1.0.60.g85f0837

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


[PATCH v2 1/4] NEWS: Remove trailing comma from an old nmbug-status config

2016-01-01 Thread W. Trevor King
That closing brace is the end of the config JSON; there won't be
anything coming after it.
---
 NEWS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 6681699..0a7a0e0 100644
--- a/NEWS
+++ b/NEWS
@@ -409,7 +409,7 @@ from the config file.  Use something like:
  ...
   },
   ...
-},
+}
 
 Python Bindings
 ---
-- 
2.1.0.60.g85f0837

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


Re: [PATCH 3/5] nmbug-status: Add an nmbug-status(5) man page

2016-01-01 Thread W. Trevor King
On Fri, Jan 01, 2016 at 01:23:37PM +0200, Tomi Ollila wrote:
> What we could simply have at the time being:
> 
>   devel/nmbug/nmbug
>   devel/nmbug/nmbug.rst (or .1)
>   devel/nmbug/nmbug-status
>   devel/nmbug/nmbug-status.rst (or .1)
>   devel/nmbug/nmbug-status-config
>   devel/nmbug/nmbug-status-config.rst (or .5)
> 
> (and if .rst:s, a Makefile to build the namual pages)

This is closer to my “separate project” idea [1], and works for me as
far as this series goes.  By not providing install tooling, we also
avoid David's concern about strongly linking the independent tools
[2].  I'll push something like it in a v2.

Once we land that, I may file a subsequent series renaming the scripts
and configs to something more general.  But we can hash that out in
that series' thread.

Cheers,
Trevor

[1]: http://thread.gmane.org/gmane.mail.notmuch.general/21535/focus=21536
 id:20151231202815.gl3...@odin.tremily.us
[2]: http://thread.gmane.org/gmane.mail.notmuch.general/21535/focus=21537
 id:87d1tm46ax.fsf@zancas.localnet

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 4/5] nmbug-status: Wrap query phrases in parentheses when and-ing together

2015-12-31 Thread W. Trevor King
On Wed, Dec 30, 2015 at 11:16:59AM -0800, W. Trevor King wrote:
> @@ -167,7 +167,8 @@ class Page (object):
>  view['title'], sort_key))
>  if 'query-string' not in view:
>  query = view['query']
> -view['query-string'] = ' and '.join(query)
> +view['query-string'] = ' and '.join(
> +'( {} )'.format(q) for q in query)

This patch is missing a similar change around line 414 to handle:

  $ nmbug-status --get-query VIEW

I've queued that for v2.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 0/2] nmbug-status: h1 title and unbalanced fixups to default templates

2015-12-31 Thread W. Trevor King
On Thu, Dec 31, 2015 at 03:46:50PM +0200, Tomi Ollila wrote:
> This series LGTM. (html) tidy complains about imo irrelevant things
> -- or I just did not know how to use it correctly -- as `| tidy
> -eq`.

That doesn't complain about anything with the current tidy 5.1.25 [1]
with output built by this branch (although I ran it on output for a
non-notmuch tag-set).

> PS: it was a bit difficult to test, had to resort to reading sources
> and experment with some git commands. So (i.e. Note to self):
> 
> $ git --git-dir ./.nmbug cat-file -p remotes/origin/config:status-config.json 
> > ~/tmp/nmbug...

There's a sample status-config.json in devel/nmbug/, so you don't have
to check with the version in the nmbug repository if you don't want
to.

> $ PYTHONPATH=$PWD/bindings/python python2.7 devel/nmbug/nmbug-status --config 
> ~/tmp/nmbug...

Yeah, if you don't have the ‘notmuch’ package installed globally,
you'll need to do something like this (although nmbug-status should
work with Python 2.6+, including the 3.x line).  The error you get
from not having notmuch installed should be fairly understandable
though:

  $ nmbug-status
  Traceback (most recent call last):
File "./nmbug-status", line 422, in 
  import notmuch
  ImportError: No module named 'notmuch'

So I'd recommend either:

  $ PYTHONPATH=$PWD/bindings/python python2.7 devel/nmbug/nmbug-status --config 
devel/nmbug/status-config.json

or installing notmuch with its Python bindings using your package
manager and running:

  $ ./devel/nmbug/nmbug-status --config devel/nmbug/status-config.json

Cheers,
Trevor

[1]: http://www.html-tidy.org/

 “Tidy reborn, Thanks for the efforts of HTACG and prominent
 contributors, HTML Tidy has a whole new heartbeat and a whole new
 life.”

 Maybe your distro-packaged tidy is just old?  I have Tidy
 20090325 from Gentoo, but 5.1.25 was cut on 2015-11-23 [2].

[2]: https://github.com/htacg/tidy-html5/releases

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 3/5] nmbug-status: Add an nmbug-status(5) man page

2015-12-31 Thread W. Trevor King
On Thu, Dec 31, 2015 at 06:11:34PM -0400, David Bremner wrote:
> W. Trevor King writes:
> > On Thu, Dec 31, 2015 at 01:39:21PM -0400, David Bremner wrote:
> >> For me it's a bit odd to have a man page for a tool we don't
> >> install by default. Is it maybe time to "promote" nmbug-status to
> >> the notmuch- namespace and install it by default?
> >
> > Sounds good to me.  And Gentoo has installed it (if you've set the
> > ‘nmbug’ USE flag [1]) since 0.11.1-r1, 2012-02-21 [2].  I'm not
> > sure what the new names should be.  nmbug → notmuch-dtag (for
> > distributed tag) and nmbug-status → notmuch-report?
>
> I'm not sure we need to deal with both tools in lockstep. It's not
> like there's an actual dependence of nmbug-status on nmbug.

Agreed.  I think they're both pretty useful though, and I don't see a
point to *not* promoting one to “easy to install with an appropriately
generic name”.  However, I'm fine promoting the tools in two separate
patch series if that would be easier to review.

> Yes, these things are easy to solve in most packaging systems, but
> we want notmuch to be installable from source as well.

So separate --without-… configure flags for each script, which will
also control the associated man pages and handle runtime-dependency
warnings/errors?

Looking over our current configure, I see we have a --without-ruby,
but no --without-python.  I may file a separate patch adding that, so
folks with Python installed can still opt-out of notmuch's Python
bindings.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH 3/5] nmbug-status: Add an nmbug-status(5) man page

2015-12-31 Thread W. Trevor King
On Thu, Dec 31, 2015 at 01:39:21PM -0400, David Bremner wrote:
> Jani Nikula writes:
> > I am wondering about the man page though. I find it slightly
> > confusing there would be a man page named after the tool
> > describing just the config, but not the tool itself.

Yeah, a man page about the tool itself would be good.  If I add one,
we'd have a situation like procmail(1) and procmailrc(5).  One
difficulty for naming the config-file-format man page is that
status-config.json is not a particularly specific name.  If we're
renaming the tools anyway, I'd suggest we just go with
${EVENTUAL_NMBUG_STATUS_NAME}.json for the default config filename and
man page.

> For me it's a bit odd to have a man page for a tool we don't install
> by default. Is it maybe time to "promote" nmbug-status to the
> notmuch- namespace and install it by default?

Sounds good to me.  And Gentoo has installed it (if you've set the
‘nmbug’ USE flag [1]) since 0.11.1-r1, 2012-02-21 [2].  I'm not sure
what the new names should be.  nmbug → notmuch-dtag (for distributed
tag) and nmbug-status → notmuch-report?

> That would have to be somehow tied to installing the python
> bindings;

On Gentoo, that happens via REQUIRED_USE [3,4].  An alternative for
packaging systems without USE-flag-style flexibility would be to spin
them off into a separate project that depends on Git and notmuch's
Python bindings.

Cheers,
Trevor

[1]: 
https://gitweb.gentoo.org/repo/gentoo.git/tree/net-mail/notmuch/metadata.xml
[2]: 
https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-mail/notmuch/ChangeLog?hideattic=0=1.23=markup
[3]: 
https://gitweb.gentoo.org/repo/gentoo.git/tree/net-mail/notmuch/notmuch-0.21.ebuild?id=45ba77ab1dee61a2590c9f4903e620c5cf4d5f68#n23
[4]: https://projects.gentoo.org/pms/6/pms.html#x1-890008.2.7

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


[PATCH 4/5] nmbug-status: Wrap query phrases in parentheses when and-ing together

2015-12-30 Thread W. Trevor King
For example:

  "query": ["tag:a", "tag:b or tag:c"]

is now converted to:

  ( tag:a ) and ( tag:b or tag:c )

instead of the old:

  tag:a and tag:b or tag:c

This helps us avoid confusion due to Xapian's higher-precedence AND
[1], where the old query would be interpreted as:

  ( tag:a and tag:b ) or tag:c

[1]: http://xapian.org/docs/queryparser.html
---
 NEWS | 3 +++
 devel/nmbug/nmbug-status | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 9a6a757..1c618d1 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,9 @@ A new `nmbug-status(5)` describes `nmbug-status`'s JSON config 
file.
 nmbug-status
 
 
+`nmbug-status` now wraps query phrases in parentheses when and-ing
+them together, to avoid confusion about clause grouping.
+
 `nmbug-status` now supports `meta.message-url` to override the Gmane
 template.  For example, you can use:
 
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 336d0d2..a477af8 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -167,7 +167,8 @@ class Page (object):
 view['title'], sort_key))
 if 'query-string' not in view:
 query = view['query']
-view['query-string'] = ' and '.join(query)
+view['query-string'] = ' and '.join(
+'( {} )'.format(q) for q in query)
 q = notmuch.Query(database, view['query-string'])
 q.set_sort(sort)
 threads = self._get_threads(messages=q.search_messages())
-- 
2.1.0.60.g85f0837

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


[PATCH 5/5] status-config.json: Remove parens from query entry

2015-12-30 Thread W. Trevor King
These are now added by nmbug-status.
---
 devel/nmbug/status-config.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devel/nmbug/status-config.json b/devel/nmbug/status-config.json
index b926946..48b6f19 100644
--- a/devel/nmbug/status-config.json
+++ b/devel/nmbug/status-config.json
@@ -62,7 +62,7 @@
"not tag:notmuch::obsolete",
"not tag:notmuch::stale",
"not tag:notmuch::wontfix",
-   "(tag:notmuch::moreinfo or tag:notmuch::needs-review)"
+   "tag:notmuch::moreinfo or tag:notmuch::needs-review"
],
"title": "Review"
}
-- 
2.1.0.60.g85f0837

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


[PATCH 3/5] nmbug-status: Add an nmbug-status(5) man page

2015-12-30 Thread W. Trevor King
To describe the config file format, so folks don't have to dig through
NEWS or the nmbug-status source to get that information.
---
 NEWS  |   5 ++
 devel/nmbug/nmbug-status  |  19 ---
 doc/conf.py   |   6 ++
 doc/index.rst |   1 +
 doc/man5/nmbug-status.rst | 136 ++
 5 files changed, 159 insertions(+), 8 deletions(-)
 create mode 100644 doc/man5/nmbug-status.rst

diff --git a/NEWS b/NEWS
index 9f2e860..9a6a757 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,11 @@
 Notmuch 0.22 (UNRELEASED)
 =
 
+Documentation
+-
+
+A new `nmbug-status(5)` describes `nmbug-status`'s JSON config file.
+
 nmbug-status
 
 
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index d72f1db..336d0d2 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -309,14 +309,17 @@ class HtmlPage (Page):
 return self._slug_regexp.sub('-', string)
 
 parser = argparse.ArgumentParser(description=__doc__)
-parser.add_argument('--text', help='output plain text format',
-action='store_true')
-parser.add_argument('--config', help='load config from given file',
-metavar='PATH')
-parser.add_argument('--list-views', help='list views',
-action='store_true')
-parser.add_argument('--get-query', help='get query for view',
-metavar='VIEW')
+parser.add_argument(
+'--text', action='store_true', help='output plain text format')
+parser.add_argument(
+'--config', metavar='PATH',
+help='load config from given file.  '
+'The format is described in nmbug-status(5).')
+parser.add_argument(
+'--list-views', action='store_true', help='list views')
+parser.add_argument(
+'--get-query', metavar='VIEW', help='get query for view')
+
 
 args = parser.parse_args()
 
diff --git a/doc/conf.py b/doc/conf.py
index 65adafe..eac747e 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -118,6 +118,9 @@ man_pages = [
 u'add/remove tags for all messages matching the search terms',
 [u'Carl Worth and many others'], 1),
 
+('man5/nmbug-status','nmbug-status',
+u'configuration for nmbug-status',
+[u'Carl Worth and many others'], 5),
 
 ]
 # If true, show URL addresses after external links.
@@ -180,4 +183,7 @@ texinfo_documents = [
 ('man1/notmuch-tag','notmuch-tag',u'notmuch Documentation',
   u'Carl Worth and many others', 'notmuch-tag',
   'add/remove tags for all messages matching the search 
terms','Miscellaneous'),
+('man5/nmbug-status','nmbug-status',u'notmuch Documentation',
+  u'Carl Worth and many others', 'nmbug-status',
+  'configuration for nmbug-status','Miscellaneous'),
 ]
diff --git a/doc/index.rst b/doc/index.rst
index 3f0e6e6..bcb1dd0 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -23,6 +23,7 @@ Contents:
man7/notmuch-search-terms
man1/notmuch-show
man1/notmuch-tag
+   man5/nmbug-status
 
 Indices and tables
 ==
diff --git a/doc/man5/nmbug-status.rst b/doc/man5/nmbug-status.rst
new file mode 100644
index 000..5b59bdd
--- /dev/null
+++ b/doc/man5/nmbug-status.rst
@@ -0,0 +1,136 @@
+
+nmbug-status
+
+
+NAME
+
+
+status-config.json - configure output for **nmbug-status(1)**
+
+DESCRIPTION
+===
+
+The config file is JSON_ with the following fields:
+
+meta
+  An object with page-wide information
+
+  title
+Page title used in the default header.
+
+  blurb
+Introduction paragraph used in the default header.
+
+  header
+`Python format string`_ for the HTML header.  Optional.  It is
+formatted with the following context:
+
+date
+  The current UTC date.
+
+datetime
+  The current UTC date-time.
+
+title
+  The **meta.title** value.
+
+blurb
+  The **meta.blurb** value.
+
+encoding
+  The encoding used for the output file.
+
+inter_message_padding
+  0.25em, for consistent CSS generation.
+
+border_radius
+  0.5em, for consistent CSS generation.
+
+  footer
+`Python format string`_ for the HTML footer.  It is formatted with
+the same context used for **meta.header**.  Optional.
+
+  message-url
+`Python format string`_ for message-linking URLs.  Optional.
+Defaults to linking Gmane_.  It is formatted with the following
+context:
+
+message-id
+  The quoted_ message ID.
+
+subject
+  The message subject.
+
+views
+  An array of view objects, where each object has the following
+  fields:
+
+  title
+Header text for the view.
+
+  comment
+Paragraph describing the view in more detail.  Optional.
+
+  id
+Anchor string for the view.  Optional, defaulting to a slugged
+form of the view title
+
+  query
+An array of strings, which will be joined with 'and' to form the
+view query.
+
+.. _Gmane: http://gmane.org/
+.. _JSON: http://json.org/
+.. _Python format 

[PATCH 2/5] nmbug-status: Add meta.message-url config setting

2015-12-30 Thread W. Trevor King
So you can link to archives other than Gmane.  For example, I'm doing
this in [1].

[1]: https://github.com/wking/nmbug-oci
---
 NEWS | 20 
 devel/nmbug/nmbug-status | 13 ++---
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 0a7a0e0..9f2e860 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,23 @@
+Notmuch 0.22 (UNRELEASED)
+=
+
+nmbug-status
+
+
+`nmbug-status` now supports `meta.message-url` to override the Gmane
+template.  For example, you can use:
+
+{
+  "meta": {
+"message-url": 
"https://groups.google.com/a/opencontainers.org/forum/#!search/messageid$3A%22{message-id}%22;
+ ...
+  },
+  ...
+}
+
+To link to messages in the [opencontainers.org Google
+Groups](https://groups.google.com/a/opencontainers.org/forum/#!overview).
+
 Notmuch 0.21 (2015-10-29)
 =
 
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index b36b6ad..d72f1db 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -19,11 +19,11 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see http://www.gnu.org/licenses/ .
 
-"""Generate HTML for one or more notmuch searches.
+"""Generate text and/or HTML for one or more notmuch searches.
 
 Messages matching each search are grouped by thread.  Each message
 that contains both a subject and message-id will have the displayed
-subject link to the Gmane view of the message.
+subject link to an archive view of the message (defaulting to Gmane).
 """
 
 from __future__ import print_function
@@ -232,6 +232,10 @@ class Page (object):
 class HtmlPage (Page):
 _slug_regexp = re.compile('\W+')
 
+def __init__(self, message_url_template, **kwargs):
+self.message_url_template = message_url_template
+super(HtmlPage, self).__init__(**kwargs)
+
 def _write_header(self, views, stream):
 super(HtmlPage, self)._write_header(views=views, stream=stream)
 stream.write('\n')
@@ -292,8 +296,9 @@ class HtmlPage (Page):
 'message-id': quote(display_data['message-id']),
 'subject': xml.sax.saxutils.escape(display_data['subject']),
 }
+d['url'] = self.message_url_template.format(**d)
 display_data['subject'] = (
-'http://mid.gmane.org/{message-id};>{subject}'
+'{subject}'
 ).format(**d)
 for key in ['message-id', 'from']:
 if key in display_data:
@@ -395,6 +400,8 @@ _PAGES['text'] = Page()
 _PAGES['html'] = HtmlPage(
 header=header_template.format(**context),
 footer=footer_template.format(**context),
+message_url_template=config['meta'].get(
+'message-url', 'http://mid.gmane.org/{message-id}'),
 )
 
 if args.list_views:
-- 
2.1.0.60.g85f0837

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


[PATCH 1/5] NEWS: Remove trailing comma from an old nmbug-status config

2015-12-30 Thread W. Trevor King
That closing brace is the end of the config JSON; there won't be
anything coming after it.
---
 NEWS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 6681699..0a7a0e0 100644
--- a/NEWS
+++ b/NEWS
@@ -409,7 +409,7 @@ from the config file.  Use something like:
  ...
   },
   ...
-},
+}
 
 Python Bindings
 ---
-- 
2.1.0.60.g85f0837

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


[PATCH 0/5] nmbug-status: meta.message-url, man page, and query parens

2015-12-30 Thread W. Trevor King
I needed meta.message-url for [1], and then felt like the config file
was getting complicated enough that it deserved some docs.

The query paren and trailing-comma fixups are drive-bys, and I can
split then out into their own series if that's easier.  I'm also happy
having patches cherry-picked out of this series as each patch passes
review.  The only strict dependency is that the man page has to land
after the meta.message-url patch, because it documents that field.

Cheers,
Trevor

[1]: https://github.com/wking/nmbug-oci

W. Trevor King (5):
  NEWS: Remove trailing comma from an old nmbug-status config
  nmbug-status: Add meta.message-url config setting
  nmbug-status: Add an nmbug-status(5) man page
  nmbug-status: Wrap query phrases in parentheses when and-ing together
  status-config.json: Remove parens from query entry

 NEWS   |  30 -
 devel/nmbug/nmbug-status   |  35 +++
 devel/nmbug/status-config.json |   2 +-
 doc/conf.py|   6 ++
 doc/index.rst  |   1 +
 doc/man5/nmbug-status.rst  | 136 +
 6 files changed, 196 insertions(+), 14 deletions(-)
 create mode 100644 doc/man5/nmbug-status.rst

-- 
2.1.0.60.g85f0837

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


[PATCH 1/2] nmbug-status: Adjust headers to start with h1

2015-12-30 Thread W. Trevor King
We've been leading off with h2s since 3e5fb88f (contrib/nmbug: add
nmbug-status script, 2012-07-07), but the semantically-correct headers
are:

  {title}
  ...
  Views
  ...
  View 1
  ...
  View 2
  ...

We can always add additional CSS if the default h1 formatting is too
intense.
---
 devel/nmbug/nmbug-status | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index b36b6ad..8fd736c 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -367,10 +367,10 @@ header_template = config['meta'].get('header', 
'''
   
 
 
-{title}
+{title}
 {blurb}
 
-Views
+Views
 ''')
 
 footer_template = config['meta'].get('footer', '''
-- 
2.1.0.60.g85f0837

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


[PATCH 2/2] nmbug-status: Fix unbalanced tags in default header/footer

2015-12-30 Thread W. Trevor King
These were broken by b70386a4 (Move the generated date from the top of
the page to the footer, 2014-05-31), which moved 'Generated ...' to
the footer with the opening tag, but didn't replace the blurb opening
tag or add a closing tag after 'Generated ...'.
---
 devel/nmbug/nmbug-status | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 8fd736c..f33f660 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -368,6 +368,7 @@ header_template = config['meta'].get('header', '''
 
 
 {title}
+
 {blurb}
 
 Views
@@ -375,7 +376,7 @@ header_template = config['meta'].get('header', '''
 
 footer_template = config['meta'].get('footer', '''
 
-Generated: {datetime}
+Generated: {datetime}
 
 
 ''')
-- 
2.1.0.60.g85f0837

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


[PATCH 0/2] nmbug-status: h1 title and unbalanced fixups to default templates

2015-12-30 Thread W. Trevor King
Polishing the templates a bit.  Details in the individual patches.

Cheers,
Trevor

W. Trevor King (2):
  nmbug-status: Adjust headers to start with h1
  nmbug-status: Fix unbalanced  tags in default header/footer

 devel/nmbug/nmbug-status | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

-- 
2.1.0.60.g85f0837

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


Re: [PATCH] nmbug-status: print config errors to stderr

2015-10-03 Thread W. Trevor King
On Sat, Oct 03, 2015 at 12:08:05PM +0300, Tomi Ollila wrote:
> On Sat, Oct 03 2015, Jani Nikula wrote:
> > Particularly scripted usage with stdout redirection can be
> > confusing if errors are printed to stdout instead of stderr.
> 
> LGTM

Me too.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] nmbug-status: add support for specifying sort order for each view

2015-04-06 Thread W. Trevor King
On Fri, Apr 03 2015, Jani Nikula  wrote:
> Let each view have "sort" key with possible values "oldest-first",
> "newest-first", and "unsorted", and sort the results
> accordingly. Oldest first remains the default.

I like it, but have a few suggestions to tweak the implementation.

>  def _write_view(self, database, view, stream):
> +sort = {
> +'oldest-first': notmuch.Query.SORT.OLDEST_FIRST,
> +'newest-first': notmuch.Query.SORT.NEWEST_FIRST,
> +'unsorted': notmuch.Query.SORT.UNSORTED
> +}

I'd rather have this mapping defined in a global variable
(_SORT_TERMS?) or a class-wide attribute (Page.sort_terms?).
Alternatively, you could do something dynamic like:

sort_key = view.get('sort', 'oldest-first')
  sort_attribute = sort_key.upper().replace('-', '_'))
  try:
  sort = getattr(notmuch.Query.SORT, sort_attribute)
  except AttributeError:
  raise ConfigError('Invalid setting for {}: {!r}'.format(
  view['title'], sort_key))

which would automatically keep the implementation in sync with the
available values in notmuch.Query.SORT.

> -q.set_sort(notmuch.Query.SORT.OLDEST_FIRST)
> +if 'sort' in view and view['sort'] in sort:
> +q.set_sort(sort[view['sort']])
> +else:
> +q.set_sort(notmuch.Query.SORT.OLDEST_FIRST)

Instead of silently falling back to oldest-first if the requested
sort-key isn't available, I think we should be raising ConfigError so
the user knows they need to update their config.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 



Re: [PATCH] nmbug-status: add support for specifying sort order for each view

2015-04-06 Thread W. Trevor King
On Fri, Apr 03 2015, Jani Nikula j...@nikula.org wrote:
 Let each view have sort key with possible values oldest-first,
 newest-first, and unsorted, and sort the results
 accordingly. Oldest first remains the default.

I like it, but have a few suggestions to tweak the implementation.

  def _write_view(self, database, view, stream):
 +sort = {
 +'oldest-first': notmuch.Query.SORT.OLDEST_FIRST,
 +'newest-first': notmuch.Query.SORT.NEWEST_FIRST,
 +'unsorted': notmuch.Query.SORT.UNSORTED
 +}

I'd rather have this mapping defined in a global variable
(_SORT_TERMS?) or a class-wide attribute (Page.sort_terms?).
Alternatively, you could do something dynamic like:

sort_key = view.get('sort', 'oldest-first')
  sort_attribute = sort_key.upper().replace('-', '_'))
  try:
  sort = getattr(notmuch.Query.SORT, sort_attribute)
  except AttributeError:
  raise ConfigError('Invalid setting for {}: {!r}'.format(
  view['title'], sort_key))

which would automatically keep the implementation in sync with the
available values in notmuch.Query.SORT.

 -q.set_sort(notmuch.Query.SORT.OLDEST_FIRST)
 +if 'sort' in view and view['sort'] in sort:
 +q.set_sort(sort[view['sort']])
 +else:
 +q.set_sort(notmuch.Query.SORT.OLDEST_FIRST)

Instead of silently falling back to oldest-first if the requested
sort-key isn't available, I think we should be raising ConfigError so
the user knows they need to update their config.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


UnicodeDecodeError with python API

2015-03-29 Thread W. Trevor King
On Sun, Mar 29, 2015 at 07:10:53PM -0400, Sebastian Fischmeister wrote:
> > My first guess is that the file's encoding doesn't match your
> > locale.  Do you have a non-ASCII locale set?  You can check with:
> 
> It seems to be more tricky than I thought. I didn't have a locale set.
> 
> When I set one, I can parse some emails with this:
> 
> export LANG=en_US.latin-1
> 
> Others with this:
> 
> export LANG=en_US.UTF-8
> 
> Others fail with either of the two.

Hmm, that's surprising.  In hindsight, the locale should only be
affecting the *output* (e.g., a non-Unicode locale might cause a
UnicodeEncodeError).  However, you're getting your errors on input.
I'd expect the files to be loaded and parsed as byte-streams, but
maybe there's a bug in Python's email parser.  It wouldn't be the
first time it's had trouble with bytes-vs-Unicode (see these old bugs
with similar tracebacks from the initial transition to 3.0 [1,2], or
search ?unicode email? on http://bugs.python.org/).  I'd try to
reproduce this failure by calling email.message_from_file(?) directly
(getting notmuch out of the loop), and then file a bug against Python
once you have a pure-Python reproduction.

Cheers,
Trevor

[1]: http://bugs.python.org/issue1086
[2]: http://bugs.python.org/issue1258#msg56470

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 



UnicodeDecodeError with python API

2015-03-29 Thread W. Trevor King
On Sun, Mar 29, 2015 at 09:08:28AM -0400, Sebastian Fischmeister wrote:
> Traceback (most recent call last):
>   File "./test.py", line 66, in 
> print(type(y.get_part(1)))
>   ?
>   File "/usr/lib/python3.4/email/parser.py", line 54, in parse
> data = fp.read(8192)
>   File "/usr/lib/python3.4/encodings/ascii.py", line 26, in decode
> return codecs.ascii_decode(input, self.errors)[0]
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3447: 
> ordinal not in range(128)

My first guess is that the file's encoding doesn't match your locale.
Do you have a non-ASCII locale set?  You can check with:

  $ locale
  LANG=en_US.UTF-8
  LC_CTYPE="en_US.UTF-8"
  LC_NUMERIC="en_US.UTF-8"
  LC_TIME="en_US.UTF-8"
  LC_COLLATE=C
  LC_MONETARY="en_US.UTF-8"
  LC_MESSAGES="en_US.UTF-8"
  LC_PAPER="en_US.UTF-8"
  LC_NAME="en_US.UTF-8"
  LC_ADDRESS="en_US.UTF-8"
  LC_TELEPHONE="en_US.UTF-8"
  LC_MEASUREMENT="en_US.UTF-8"
  LC_IDENTIFICATION="en_US.UTF-8"
  LC_ALL=

Although you can obviously have a different preferred language or
Unicode-capable encoding.  What you don't want is:

  # locale
  LANG=
  LC_CTYPE="POSIX"
  LC_NUMERIC="POSIX"
  LC_TIME="POSIX"
  LC_COLLATE="POSIX"
  LC_MONETARY="POSIX"
  LC_MESSAGES="POSIX"
  LC_PAPER="POSIX"
  LC_NAME="POSIX"
  LC_ADDRESS="POSIX"
  LC_TELEPHONE="POSIX"
  LC_MEASUREMENT="POSIX"
  LC_IDENTIFICATION="POSIX"
  LC_ALL=

If that's not the problem, could you attach the troublesome message?
Or a minimal example derived from the troublesome message?

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 



Re: UnicodeDecodeError with python API

2015-03-29 Thread W. Trevor King
On Sun, Mar 29, 2015 at 07:10:53PM -0400, Sebastian Fischmeister wrote:
  My first guess is that the file's encoding doesn't match your
  locale.  Do you have a non-ASCII locale set?  You can check with:
 
 It seems to be more tricky than I thought. I didn't have a locale set.
 
 When I set one, I can parse some emails with this:
 
 export LANG=en_US.latin-1
 
 Others with this:
 
 export LANG=en_US.UTF-8
 
 Others fail with either of the two.

Hmm, that's surprising.  In hindsight, the locale should only be
affecting the *output* (e.g., a non-Unicode locale might cause a
UnicodeEncodeError).  However, you're getting your errors on input.
I'd expect the files to be loaded and parsed as byte-streams, but
maybe there's a bug in Python's email parser.  It wouldn't be the
first time it's had trouble with bytes-vs-Unicode (see these old bugs
with similar tracebacks from the initial transition to 3.0 [1,2], or
search “unicode email” on http://bugs.python.org/).  I'd try to
reproduce this failure by calling email.message_from_file(…) directly
(getting notmuch out of the loop), and then file a bug against Python
once you have a pure-Python reproduction.

Cheers,
Trevor

[1]: http://bugs.python.org/issue1086
[2]: http://bugs.python.org/issue1258#msg56470

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: UnicodeDecodeError with python API

2015-03-29 Thread W. Trevor King
On Sun, Mar 29, 2015 at 09:08:28AM -0400, Sebastian Fischmeister wrote:
 Traceback (most recent call last):
   File ./test.py, line 66, in module
 print(type(y.get_part(1)))
   …
   File /usr/lib/python3.4/email/parser.py, line 54, in parse
 data = fp.read(8192)
   File /usr/lib/python3.4/encodings/ascii.py, line 26, in decode
 return codecs.ascii_decode(input, self.errors)[0]
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3447: 
 ordinal not in range(128)

My first guess is that the file's encoding doesn't match your locale.
Do you have a non-ASCII locale set?  You can check with:

  $ locale
  LANG=en_US.UTF-8
  LC_CTYPE=en_US.UTF-8
  LC_NUMERIC=en_US.UTF-8
  LC_TIME=en_US.UTF-8
  LC_COLLATE=C
  LC_MONETARY=en_US.UTF-8
  LC_MESSAGES=en_US.UTF-8
  LC_PAPER=en_US.UTF-8
  LC_NAME=en_US.UTF-8
  LC_ADDRESS=en_US.UTF-8
  LC_TELEPHONE=en_US.UTF-8
  LC_MEASUREMENT=en_US.UTF-8
  LC_IDENTIFICATION=en_US.UTF-8
  LC_ALL=

Although you can obviously have a different preferred language or
Unicode-capable encoding.  What you don't want is:

  # locale
  LANG=
  LC_CTYPE=POSIX
  LC_NUMERIC=POSIX
  LC_TIME=POSIX
  LC_COLLATE=POSIX
  LC_MONETARY=POSIX
  LC_MESSAGES=POSIX
  LC_PAPER=POSIX
  LC_NAME=POSIX
  LC_ADDRESS=POSIX
  LC_TELEPHONE=POSIX
  LC_MEASUREMENT=POSIX
  LC_IDENTIFICATION=POSIX
  LC_ALL=

If that's not the problem, could you attach the troublesome message?
Or a minimal example derived from the troublesome message?

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] NEWS: fix 'not' -> 'now' typo in 0.19 nmbug section

2015-03-28 Thread W. Trevor King
---
 NEWS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 70ad3f3..8a1b310 100644
--- a/NEWS
+++ b/NEWS
@@ -167,7 +167,7 @@ nmbug

 The Perl script has been translated to Python; you'll need Python 2.7
 or anything from the 3.x line.  Most of the user-facing interface is
-the same, but `nmbug help` is not `nmbug --help`, and the following nmbug
+the same, but `nmbug help` is now `nmbug --help`, and the following nmbug
 commands have slightly different interfaces: `archive`, `commit`,
 `fetch`, `log`, `pull`, `push`, and `status`.  For details on the
 new interface for a given command, run `nmbug COMMAND --help`.
-- 
2.1.0.60.g85f0837



[PATCH] NEWS: fix 'not' - 'now' typo in 0.19 nmbug section

2015-03-28 Thread W. Trevor King
---
 NEWS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 70ad3f3..8a1b310 100644
--- a/NEWS
+++ b/NEWS
@@ -167,7 +167,7 @@ nmbug
 
 The Perl script has been translated to Python; you'll need Python 2.7
 or anything from the 3.x line.  Most of the user-facing interface is
-the same, but `nmbug help` is not `nmbug --help`, and the following nmbug
+the same, but `nmbug help` is now `nmbug --help`, and the following nmbug
 commands have slightly different interfaces: `archive`, `commit`,
 `fetch`, `log`, `pull`, `push`, and `status`.  For details on the
 new interface for a given command, run `nmbug COMMAND --help`.
-- 
2.1.0.60.g85f0837

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


[PATCH v4] nmbug-status: Use 'show-ref --heads' for loading configs

2015-03-22 Thread W. Trevor King
When loading configs from Git, the bare branch name (without a
refs/heads/ prefix or similar) matches all branches of that name
(including remote-tracking branches):

  .nmbug $ git show-ref config
  48f3bbf1d1492e5f3d2f01de6ea79a30d3840f20 refs/heads/config
  48f3bbf1d1492e5f3d2f01de6ea79a30d3840f20 refs/remotes/origin/config
  4b6dbd9ffd152e7476f5101eff26747f34497cee refs/remotes/wking/config

Instead of relying on the ordering of the matching references, use
--heads to ensure we only match local branches.
---
The only change from v3 [1] is dropping the accidental indentation
hunk that started with '@@ -178,14 +193,14 @@ nmbug-status'.  Thanks
to Tomi for pointing this out on IRC.

[1]: id: e9d25cc269b7bcc058627466adfa2835256b6e76.1427012574.git.wking at 
tremily.us
 http://thread.gmane.org/gmane.mail.notmuch.general/20356

 NEWS | 15 +++
 devel/nmbug/nmbug|  1 +
 devel/nmbug/nmbug-status |  2 +-
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 70ad3f3..336a7c3 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,21 @@ Contrib
 previously provided by `notmuch-deliver` should now be provided by
 `notmuch insert`, provided by the main notmuch binary.

+nmbug-status
+
+
+`nmbug-status` now only matches local branches when reading
+`status-config.json` from the `config` branch of the `NMBGIT`
+repository.  To help new users running `nmbug-status`, `nmbug clone`
+now creates a local `config` branch tracking `origin/config`.  Folks
+who use `nmbug-status` with an in-Git config (i.e. you don't use the
+`--config` option) who already have `NMBGIT` set up are encouraged to
+run:
+
+git checkout config origin/config
+
+in their `NMBGIT` repository (usually `~/.nmbug`).
+
 Notmuch 0.19 (2014-11-14)
 =

diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index 932ec12..81f582c 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -308,6 +308,7 @@ def clone(repository):
 wait=True)
 _git(args=['config', '--unset', 'core.worktree'], wait=True)
 _git(args=['config', 'core.bare', 'true'], wait=True)
+_git(args=['branch', 'config', 'origin/config'], wait=True)


 def _is_committed(status):
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 19dc48a..e845c2a 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -92,7 +92,7 @@ def read_config(path=None, encoding=None):

 # read only the first line from the pipe
 sha1_bytes = subprocess.Popen(
-['git', '--git-dir', nmbhome, 'show-ref', '-s', branch],
+['git', '--git-dir', nmbhome, 'show-ref', '-s', '--heads', branch],
 stdout=subprocess.PIPE).stdout.readline()
 sha1 = sha1_bytes.decode(encoding).rstrip()
 if not sha1:
-- 
2.1.0.60.g85f0837



[PATCH v2] nmbug-status: Use 'show-ref --heads' for loading configs

2015-03-22 Thread W. Trevor King
On Sat, Mar 21, 2015 at 10:28:05AM +0200, Tomi Ollila wrote:
> But why is the NEWS brurb added deep into 0.19 NEWS content ?

Oops, I was just looking for the nmbug section and didn't see that
we're now post 0.19 ;).   Fixed in v3 [1].

Cheers,
Trevor

[3]: id:e9d25cc269b7bcc058627466adfa2835256b6e76.1427012574.git.wking at 
tremily.us
 http://article.gmane.org/gmane.mail.notmuch.general/20356

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 



[PATCH v3] nmbug-status: Use 'show-ref --heads' for loading configs

2015-03-22 Thread W. Trevor King
When loading configs from Git, the bare branch name (without a
refs/heads/ prefix or similar) matches all branches of that name
(including remote-tracking branches):

  .nmbug $ git show-ref config
  48f3bbf1d1492e5f3d2f01de6ea79a30d3840f20 refs/heads/config
  48f3bbf1d1492e5f3d2f01de6ea79a30d3840f20 refs/remotes/origin/config
  4b6dbd9ffd152e7476f5101eff26747f34497cee refs/remotes/wking/config

Instead of relying on the ordering of the matching references, use
--heads to ensure we only match local branches.
---
The only change since v2 [1] is shifting the NEWS entry into the
unreleased 0.20 section [2].

[1]: id:5e97afaab6c01e980ca6194a1c04aa0310e28ab8.1426412504.git.wking at 
tremily.us
 http://thread.gmane.org/gmane.mail.notmuch.general/20344/
[2]: id:m2bnjm7o16.fsf at guru.guru-group.fi
 http://article.gmane.org/gmane.mail.notmuch.general/20350


 NEWS | 31 +++
 devel/nmbug/nmbug|  1 +
 devel/nmbug/nmbug-status |  2 +-
 3 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/NEWS b/NEWS
index 70ad3f3..de13bbd 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,21 @@ Contrib
 previously provided by `notmuch-deliver` should now be provided by
 `notmuch insert`, provided by the main notmuch binary.

+nmbug-status
+
+
+`nmbug-status` now only matches local branches when reading
+`status-config.json` from the `config` branch of the `NMBGIT`
+repository.  To help new users running `nmbug-status`, `nmbug clone`
+now creates a local `config` branch tracking `origin/config`.  Folks
+who use `nmbug-status` with an in-Git config (i.e. you don't use the
+`--config` option) who already have `NMBGIT` set up are encouraged to
+run:
+
+git checkout config origin/config
+
+in their `NMBGIT` repository (usually `~/.nmbug`).
+
 Notmuch 0.19 (2014-11-14)
 =

@@ -178,14 +193,14 @@ nmbug-status
 `nmbug-status` can now optionally load header and footer templates
 from the config file.  Use something like:

-{
-  "meta": {
-"header": "\n\n...",
-"footer": "",
- ...
-  },
-  ...
-},
+{
+"meta": {
+"header": "\n\n...",
+"footer": "",
+...
+},
+...
+},

 Python Bindings
 ---
diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index 932ec12..81f582c 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -308,6 +308,7 @@ def clone(repository):
 wait=True)
 _git(args=['config', '--unset', 'core.worktree'], wait=True)
 _git(args=['config', 'core.bare', 'true'], wait=True)
+_git(args=['branch', 'config', 'origin/config'], wait=True)


 def _is_committed(status):
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 19dc48a..e845c2a 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -92,7 +92,7 @@ def read_config(path=None, encoding=None):

 # read only the first line from the pipe
 sha1_bytes = subprocess.Popen(
-['git', '--git-dir', nmbhome, 'show-ref', '-s', branch],
+['git', '--git-dir', nmbhome, 'show-ref', '-s', '--heads', branch],
 stdout=subprocess.PIPE).stdout.readline()
 sha1 = sha1_bytes.decode(encoding).rstrip()
 if not sha1:
-- 
2.1.0.60.g85f0837



[PATCH v3] nmbug-status: Use 'show-ref --heads' for loading configs

2015-03-22 Thread W. Trevor King
When loading configs from Git, the bare branch name (without a
refs/heads/ prefix or similar) matches all branches of that name
(including remote-tracking branches):

  .nmbug $ git show-ref config
  48f3bbf1d1492e5f3d2f01de6ea79a30d3840f20 refs/heads/config
  48f3bbf1d1492e5f3d2f01de6ea79a30d3840f20 refs/remotes/origin/config
  4b6dbd9ffd152e7476f5101eff26747f34497cee refs/remotes/wking/config

Instead of relying on the ordering of the matching references, use
--heads to ensure we only match local branches.
---
The only change since v2 [1] is shifting the NEWS entry into the
unreleased 0.20 section [2].

[1]: id:5e97afaab6c01e980ca6194a1c04aa0310e28ab8.1426412504.git.wk...@tremily.us
 http://thread.gmane.org/gmane.mail.notmuch.general/20344/
[2]: id:m2bnjm7o16@guru.guru-group.fi
 http://article.gmane.org/gmane.mail.notmuch.general/20350


 NEWS | 31 +++
 devel/nmbug/nmbug|  1 +
 devel/nmbug/nmbug-status |  2 +-
 3 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/NEWS b/NEWS
index 70ad3f3..de13bbd 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,21 @@ Contrib
 previously provided by `notmuch-deliver` should now be provided by
 `notmuch insert`, provided by the main notmuch binary.
 
+nmbug-status
+
+
+`nmbug-status` now only matches local branches when reading
+`status-config.json` from the `config` branch of the `NMBGIT`
+repository.  To help new users running `nmbug-status`, `nmbug clone`
+now creates a local `config` branch tracking `origin/config`.  Folks
+who use `nmbug-status` with an in-Git config (i.e. you don't use the
+`--config` option) who already have `NMBGIT` set up are encouraged to
+run:
+
+git checkout config origin/config
+
+in their `NMBGIT` repository (usually `~/.nmbug`).
+
 Notmuch 0.19 (2014-11-14)
 =
 
@@ -178,14 +193,14 @@ nmbug-status
 `nmbug-status` can now optionally load header and footer templates
 from the config file.  Use something like:
 
-{
-  meta: {
-header: !DOCTYPE html\nhtml lang=en\n...,
-footer: /body/html,
- ...
-  },
-  ...
-},
+{
+meta: {
+header: !DOCTYPE html\nhtml lang=en\n...,
+footer: /body/html,
+...
+},
+...
+},
 
 Python Bindings
 ---
diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index 932ec12..81f582c 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -308,6 +308,7 @@ def clone(repository):
 wait=True)
 _git(args=['config', '--unset', 'core.worktree'], wait=True)
 _git(args=['config', 'core.bare', 'true'], wait=True)
+_git(args=['branch', 'config', 'origin/config'], wait=True)
 
 
 def _is_committed(status):
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 19dc48a..e845c2a 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -92,7 +92,7 @@ def read_config(path=None, encoding=None):
 
 # read only the first line from the pipe
 sha1_bytes = subprocess.Popen(
-['git', '--git-dir', nmbhome, 'show-ref', '-s', branch],
+['git', '--git-dir', nmbhome, 'show-ref', '-s', '--heads', branch],
 stdout=subprocess.PIPE).stdout.readline()
 sha1 = sha1_bytes.decode(encoding).rstrip()
 if not sha1:
-- 
2.1.0.60.g85f0837

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


Re: [PATCH v2] nmbug-status: Use 'show-ref --heads' for loading configs

2015-03-22 Thread W. Trevor King
On Sat, Mar 21, 2015 at 10:28:05AM +0200, Tomi Ollila wrote:
 But why is the NEWS brurb added deep into 0.19 NEWS content ?

Oops, I was just looking for the nmbug section and didn't see that
we're now post 0.19 ;).   Fixed in v3 [1].

Cheers,
Trevor

[3]: id:e9d25cc269b7bcc058627466adfa2835256b6e76.1427012574.git.wk...@tremily.us
 http://article.gmane.org/gmane.mail.notmuch.general/20356

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v4] nmbug-status: Use 'show-ref --heads' for loading configs

2015-03-22 Thread W. Trevor King
When loading configs from Git, the bare branch name (without a
refs/heads/ prefix or similar) matches all branches of that name
(including remote-tracking branches):

  .nmbug $ git show-ref config
  48f3bbf1d1492e5f3d2f01de6ea79a30d3840f20 refs/heads/config
  48f3bbf1d1492e5f3d2f01de6ea79a30d3840f20 refs/remotes/origin/config
  4b6dbd9ffd152e7476f5101eff26747f34497cee refs/remotes/wking/config

Instead of relying on the ordering of the matching references, use
--heads to ensure we only match local branches.
---
The only change from v3 [1] is dropping the accidental indentation
hunk that started with '@@ -178,14 +193,14 @@ nmbug-status'.  Thanks
to Tomi for pointing this out on IRC.

[1]: id: 
e9d25cc269b7bcc058627466adfa2835256b6e76.1427012574.git.wk...@tremily.us
 http://thread.gmane.org/gmane.mail.notmuch.general/20356

 NEWS | 15 +++
 devel/nmbug/nmbug|  1 +
 devel/nmbug/nmbug-status |  2 +-
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 70ad3f3..336a7c3 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,21 @@ Contrib
 previously provided by `notmuch-deliver` should now be provided by
 `notmuch insert`, provided by the main notmuch binary.
 
+nmbug-status
+
+
+`nmbug-status` now only matches local branches when reading
+`status-config.json` from the `config` branch of the `NMBGIT`
+repository.  To help new users running `nmbug-status`, `nmbug clone`
+now creates a local `config` branch tracking `origin/config`.  Folks
+who use `nmbug-status` with an in-Git config (i.e. you don't use the
+`--config` option) who already have `NMBGIT` set up are encouraged to
+run:
+
+git checkout config origin/config
+
+in their `NMBGIT` repository (usually `~/.nmbug`).
+
 Notmuch 0.19 (2014-11-14)
 =
 
diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index 932ec12..81f582c 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -308,6 +308,7 @@ def clone(repository):
 wait=True)
 _git(args=['config', '--unset', 'core.worktree'], wait=True)
 _git(args=['config', 'core.bare', 'true'], wait=True)
+_git(args=['branch', 'config', 'origin/config'], wait=True)
 
 
 def _is_committed(status):
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 19dc48a..e845c2a 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -92,7 +92,7 @@ def read_config(path=None, encoding=None):
 
 # read only the first line from the pipe
 sha1_bytes = subprocess.Popen(
-['git', '--git-dir', nmbhome, 'show-ref', '-s', branch],
+['git', '--git-dir', nmbhome, 'show-ref', '-s', '--heads', branch],
 stdout=subprocess.PIPE).stdout.readline()
 sha1 = sha1_bytes.decode(encoding).rstrip()
 if not sha1:
-- 
2.1.0.60.g85f0837

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


[PATCH v2] nmbug-status: Use 'show-ref --heads' for loading configs

2015-03-15 Thread W. Trevor King
When loading configs from Git, the bare branch name (without a
refs/heads/ prefix or similar) matches all branches of that name
(including remote-tracking branches):

  .nmbug $ git show-ref config
  48f3bbf1d1492e5f3d2f01de6ea79a30d3840f20 refs/heads/config
  48f3bbf1d1492e5f3d2f01de6ea79a30d3840f20 refs/remotes/origin/config
  4b6dbd9ffd152e7476f5101eff26747f34497cee refs/remotes/wking/config

Instead of relying on the ordering of the matching references, use
--heads to ensure we only match local branches.
---
This is v2 of [1], with the only changes being:

* Relocate the NEWS blurb to fit into the current pending release
  (0.20).
* Translate the 'nmbug' patch from Perl to Python.

[1]: id:7ddcf7368895768aa0a2d37dac0d4f96e9666f16.1399749244.git.wking at 
tremily.us
 http://article.gmane.org/gmane.mail.notmuch.general/18306

 NEWS | 12 
 devel/nmbug/nmbug|  1 +
 devel/nmbug/nmbug-status |  2 +-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 70ad3f3..0441587 100644
--- a/NEWS
+++ b/NEWS
@@ -187,6 +187,18 @@ from the config file.  Use something like:
   ...
 },

+`nmbug-status` now only matches local branches when reading
+`status-config.json` from the `config` branch of the `NMBGIT`
+repository.  To help new users running `nmbug-status`, `nmbug clone`
+now creates a local `config` branch tracking `origin/config`.  Folks
+who use `nmbug-status` with an in-Git config (i.e. you don't use the
+`--config` option) who already have `NMBGIT` set up are encouraged to
+run:
+
+git checkout config origin/config
+
+in their `NMBGIT` repository (usually `~/.nmbug`).
+
 Python Bindings
 ---

diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index 932ec12..81f582c 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -308,6 +308,7 @@ def clone(repository):
 wait=True)
 _git(args=['config', '--unset', 'core.worktree'], wait=True)
 _git(args=['config', 'core.bare', 'true'], wait=True)
+_git(args=['branch', 'config', 'origin/config'], wait=True)


 def _is_committed(status):
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 19dc48a..e845c2a 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -92,7 +92,7 @@ def read_config(path=None, encoding=None):

 # read only the first line from the pipe
 sha1_bytes = subprocess.Popen(
-['git', '--git-dir', nmbhome, 'show-ref', '-s', branch],
+['git', '--git-dir', nmbhome, 'show-ref', '-s', '--heads', branch],
 stdout=subprocess.PIPE).stdout.readline()
 sha1 = sha1_bytes.decode(encoding).rstrip()
 if not sha1:
-- 
1.8.4



[PATCH 1/2] nmbug-status: Clarify errors for illegible configs

2015-03-15 Thread W. Trevor King
On Sun, Mar 15, 2015 at 09:32:13AM +0100, David Bremner wrote:
> The second patch touches the perl version of nmbug, so I'm guessing
> you rolled it into the python rewrite.

No, the Python bit was pretty much a straight translation.  I'll port
the second patch over and resubmit.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 



[PATCH v2] nmbug-status: Use 'show-ref --heads' for loading configs

2015-03-15 Thread W. Trevor King
When loading configs from Git, the bare branch name (without a
refs/heads/ prefix or similar) matches all branches of that name
(including remote-tracking branches):

  .nmbug $ git show-ref config
  48f3bbf1d1492e5f3d2f01de6ea79a30d3840f20 refs/heads/config
  48f3bbf1d1492e5f3d2f01de6ea79a30d3840f20 refs/remotes/origin/config
  4b6dbd9ffd152e7476f5101eff26747f34497cee refs/remotes/wking/config

Instead of relying on the ordering of the matching references, use
--heads to ensure we only match local branches.
---
This is v2 of [1], with the only changes being:

* Relocate the NEWS blurb to fit into the current pending release
  (0.20).
* Translate the 'nmbug' patch from Perl to Python.

[1]: id:7ddcf7368895768aa0a2d37dac0d4f96e9666f16.1399749244.git.wk...@tremily.us
 http://article.gmane.org/gmane.mail.notmuch.general/18306

 NEWS | 12 
 devel/nmbug/nmbug|  1 +
 devel/nmbug/nmbug-status |  2 +-
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 70ad3f3..0441587 100644
--- a/NEWS
+++ b/NEWS
@@ -187,6 +187,18 @@ from the config file.  Use something like:
   ...
 },
 
+`nmbug-status` now only matches local branches when reading
+`status-config.json` from the `config` branch of the `NMBGIT`
+repository.  To help new users running `nmbug-status`, `nmbug clone`
+now creates a local `config` branch tracking `origin/config`.  Folks
+who use `nmbug-status` with an in-Git config (i.e. you don't use the
+`--config` option) who already have `NMBGIT` set up are encouraged to
+run:
+
+git checkout config origin/config
+
+in their `NMBGIT` repository (usually `~/.nmbug`).
+
 Python Bindings
 ---
 
diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index 932ec12..81f582c 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -308,6 +308,7 @@ def clone(repository):
 wait=True)
 _git(args=['config', '--unset', 'core.worktree'], wait=True)
 _git(args=['config', 'core.bare', 'true'], wait=True)
+_git(args=['branch', 'config', 'origin/config'], wait=True)
 
 
 def _is_committed(status):
diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status
index 19dc48a..e845c2a 100755
--- a/devel/nmbug/nmbug-status
+++ b/devel/nmbug/nmbug-status
@@ -92,7 +92,7 @@ def read_config(path=None, encoding=None):
 
 # read only the first line from the pipe
 sha1_bytes = subprocess.Popen(
-['git', '--git-dir', nmbhome, 'show-ref', '-s', branch],
+['git', '--git-dir', nmbhome, 'show-ref', '-s', '--heads', branch],
 stdout=subprocess.PIPE).stdout.readline()
 sha1 = sha1_bytes.decode(encoding).rstrip()
 if not sha1:
-- 
1.8.4

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


Re: [PATCH 1/2] nmbug-status: Clarify errors for illegible configs

2015-03-15 Thread W. Trevor King
On Sun, Mar 15, 2015 at 09:32:13AM +0100, David Bremner wrote:
 The second patch touches the perl version of nmbug, so I'm guessing
 you rolled it into the python rewrite.

No, the Python bit was pretty much a straight translation.  I'll port
the second patch over and resubmit.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[Patch v2 2/4] doc: add more information on operators.

2015-02-23 Thread W. Trevor King
On Mon, Feb 23, 2015 at 09:05:35PM +0100, David Bremner wrote:
> +In addition to individual terms, multiple terms can be combined with
> +Boolean operators (**and**, **or**, **not**, and **xor**). Each term
> +in the query will be implicitly connected by a logical AND if no
> +explicit operator is provided, (except that terms with a common prefix
> +will be implicitly combined with OR).  The shorthand '-' can be used 
> for 'not ' but
> +unfortunately this does not work at the start of an expression.
>  Parentheses can also be used to control the combination of the Boolean
>  operators, but will have to be protected from interpretation by the
>  shell, (such as by putting quotation marks around any parenthesized
>  expression).

We should probably:

* Re-wrap the paragraph to avoid one long line.
* Drop the comma before the ?(except ?)? parens.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 



[PATCH v4] nmbug: Add an 'init' command

2015-01-19 Thread W. Trevor King
On Mon, Jan 19, 2015 at 11:44:16AM +0200, Tomi Ollila wrote:
> $ python2.7 devel/nmbug/nmbug init
> Reinitialized existing Git repository in /home/too/.nmbug/
> e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
> user.name not defined
> [u'git', u'--git-dir', u'/home/too/.nmbug', u'commit', u'--allow-empty',
> u'-m', u'Start a new nmbug repository'] exited with 1
> zsh: exit 1 python2.7 devel/nmbug/nmbug init
> 
> This is due to my default /path/to/git-templates/pre-commit
> forbidding commits unless I've configured user.name & user.email for
> that particular repository
> 
> I guess there is not much one can do to handle users' mystic global
> hooks -- I'll look (later) whether e.g. '--no-hooks' parameter could
> be given to nmbug from command line...
> 
> ... Ok, it was --no-verify and patching that to the command line
> worked -- git complained that "Your name and email address were
> configured automatically based on your username and hostname..."?

Hmm.  My initial feeling is that if your pre-commit hook doesn't want
you to commit, we should respect that.  Although I'm not sure how to
handle this case for folks like you that don't define a global
username or email address.  Possibilities:

* Drop the empty commit from ?nmbug init? and teach ?nmbug log?,
  ?status?, ?commit?, etc. to handle the ?we don't have any commits
  yet? case?  That gives you time between the init and first commit to
  go into the repository and setup your username and email address by
  hand.  This would be the most work, but gives us a more native
  solution (?nmbug init? maps more directly to ?git init?).

* Adjust the syntax to:

nmbug init -- {arguments passed through to ?git commit?}

  so you could run:

nmbug init -- --author 'A U Thor '

  or:

nmbug init -- --no-verify

  this works as long as the tweak you need is accessible from a ?git
  commit? argument (I guess --no-verify covers us there).

> ? but commit succeeded :).


Re: [PATCH v4] nmbug: Add an 'init' command

2015-01-19 Thread W. Trevor King
On Mon, Jan 19, 2015 at 11:44:16AM +0200, Tomi Ollila wrote:
 $ python2.7 devel/nmbug/nmbug init
 Reinitialized existing Git repository in /home/too/.nmbug/
 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
 user.name not defined
 [u'git', u'--git-dir', u'/home/too/.nmbug', u'commit', u'--allow-empty',
 u'-m', u'Start a new nmbug repository'] exited with 1
 zsh: exit 1 python2.7 devel/nmbug/nmbug init
 
 This is due to my default /path/to/git-templates/pre-commit
 forbidding commits unless I've configured user.name  user.email for
 that particular repository
 
 I guess there is not much one can do to handle users' mystic global
 hooks -- I'll look (later) whether e.g. '--no-hooks' parameter could
 be given to nmbug from command line...
 
 ... Ok, it was --no-verify and patching that to the command line
 worked -- git complained that Your name and email address were
 configured automatically based on your username and hostname...…

Hmm.  My initial feeling is that if your pre-commit hook doesn't want
you to commit, we should respect that.  Although I'm not sure how to
handle this case for folks like you that don't define a global
username or email address.  Possibilities:

* Drop the empty commit from ‘nmbug init’ and teach ‘nmbug log’,
  ‘status’, ‘commit’, etc. to handle the “we don't have any commits
  yet” case?  That gives you time between the init and first commit to
  go into the repository and setup your username and email address by
  hand.  This would be the most work, but gives us a more native
  solution (‘nmbug init’ maps more directly to ‘git init’).

* Adjust the syntax to:

nmbug init -- {arguments passed through to ‘git commit’}

  so you could run:

nmbug init -- --author 'A U Thor aut...@example.com'

  or:

nmbug init -- --no-verify

  this works as long as the tweak you need is accessible from a ‘git
  commit’ argument (I guess --no-verify covers us there).

 … but commit succeeded :).

From the template pre-commit.sample:

  The hook should exit with non-zero status after issuing an
  appropriate message if it wants to stop the commit.

so you should check that your hook is doing that if you expect to
abort commits it doesn't like ;).

 I think it should be checked so that init on already-existing
 repository does not succeed.

Good point.  I've added:

  if _os.path.exists(NMBGIT):
  raise ValueError('NMBGIT path ({!r}) already exists'.format(NMBGIT))

for v5.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v4] nmbug: Add an 'init' command

2015-01-18 Thread W. Trevor King
For folks that want to start versioning a new tag-space, instead of
cloning one that someone else has already started.

The empty-blob hash-object call avoids errors like:

  $ nmbug commit
  error: invalid object 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 for
'tags/...'
  fatal: git-write-tree: error building trees
  'git HASH(0x9ef3eb8) write-tree' exited with nonzero value

David Bremner suggested [1]:

  $ git hash-object -w /dev/null

instead of my Python version of:

  $ git hash-object -w --stdin <&-

but I expect that closing stdin is more portable than the /dev/null
path (which doesn't exist on Windows, for example).

The --bare init and use of NMBGIT as the work tree (what could go
wrong with an empty commit?) are suggestions from Michal Sojka [2].

[1]: id:87y4vu6uvf.fsf at maritornes.cs.unb.ca
 http://thread.gmane.org/gmane.mail.notmuch.general/18626/focus=18720
[2]: id:87a93a5or2.fsf at resox.2x.cz
 http://thread.gmane.org/gmane.mail.notmuch.general/19495/focus=19767
---
Since v3 [1] I've incorporated Michal's suggestions [2]:

* Start with 'git --git-dir {NMBGIT} init --bare
* Use NMBGIT instead of a temporary workdir when creating the initial
  ?Start a new nmbug repository? commit.

As well as the core.logallrefupdates tweak I turned up in testing [3].

[1]: id:113512958b3fd64902517c1c55576faef816f852.1414532174.git.wking at 
tremily.us
 http://thread.gmane.org/gmane.mail.notmuch.general/19495
[2]: id:87a93a5or2.fsf at resox.2x.cz
 http://thread.gmane.org/gmane.mail.notmuch.general/19495/focus=19767
[3]: id:20141129201829.GI4062 at odin.tremily.us
 http://thread.gmane.org/gmane.mail.notmuch.general/19495/focus=19774

 devel/nmbug/nmbug | 20 
 1 file changed, 20 insertions(+)

diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index 932ec12..1297345 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -374,6 +374,25 @@ def fetch(remote=None):
 _git(args=args, wait=True)


+def init(remote=None):
+"""
+Create an empty nmbug repository.
+
+This wraps 'git init' with a few extra steps to support subsequent
+status and commit commands.
+"""
+_spawn(args=['git', '--git-dir', NMBGIT, 'init', '--bare'], wait=True)
+_git(args=['config', 'core.logallrefupdates', 'true'], wait=True)
+# create an empty blob (e69de29bb2d1d6434b8b29ae775ad8c2e48c5391)
+_git(args=['hash-object', '-w', '--stdin'], input='', wait=True)
+_git(
+args=[
+'commit', '--allow-empty', '-m', 'Start a new nmbug repository'
+],
+additional_env={'GIT_WORK_TREE': NMBGIT},
+wait=True)
+
+
 def checkout():
 """
 Update the notmuch database from Git.
@@ -725,6 +744,7 @@ if __name__ == '__main__':
 'commit',
 'fetch',
 'help',
+'init',
 'log',
 'merge',
 'pull',
-- 
2.1.0.60.g85f0837



[PATCH] doc: remove support for rst2man

2015-01-18 Thread W. Trevor King
Looks good to me :).

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 



[PATCH v4] nmbug: Add an 'init' command

2015-01-18 Thread W. Trevor King
For folks that want to start versioning a new tag-space, instead of
cloning one that someone else has already started.

The empty-blob hash-object call avoids errors like:

  $ nmbug commit
  error: invalid object 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 for
'tags/...'
  fatal: git-write-tree: error building trees
  'git HASH(0x9ef3eb8) write-tree' exited with nonzero value

David Bremner suggested [1]:

  $ git hash-object -w /dev/null

instead of my Python version of:

  $ git hash-object -w --stdin -

but I expect that closing stdin is more portable than the /dev/null
path (which doesn't exist on Windows, for example).

The --bare init and use of NMBGIT as the work tree (what could go
wrong with an empty commit?) are suggestions from Michal Sojka [2].

[1]: id:87y4vu6uvf@maritornes.cs.unb.ca
 http://thread.gmane.org/gmane.mail.notmuch.general/18626/focus=18720
[2]: id:87a93a5or2@resox.2x.cz
 http://thread.gmane.org/gmane.mail.notmuch.general/19495/focus=19767
---
Since v3 [1] I've incorporated Michal's suggestions [2]:

* Start with 'git --git-dir {NMBGIT} init --bare
* Use NMBGIT instead of a temporary workdir when creating the initial
  “Start a new nmbug repository” commit.

As well as the core.logallrefupdates tweak I turned up in testing [3].

[1]: id:113512958b3fd64902517c1c55576faef816f852.1414532174.git.wk...@tremily.us
 http://thread.gmane.org/gmane.mail.notmuch.general/19495
[2]: id:87a93a5or2@resox.2x.cz
 http://thread.gmane.org/gmane.mail.notmuch.general/19495/focus=19767
[3]: id:20141129201829.gi4...@odin.tremily.us
 http://thread.gmane.org/gmane.mail.notmuch.general/19495/focus=19774

 devel/nmbug/nmbug | 20 
 1 file changed, 20 insertions(+)

diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index 932ec12..1297345 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -374,6 +374,25 @@ def fetch(remote=None):
 _git(args=args, wait=True)
 
 
+def init(remote=None):
+
+Create an empty nmbug repository.
+
+This wraps 'git init' with a few extra steps to support subsequent
+status and commit commands.
+
+_spawn(args=['git', '--git-dir', NMBGIT, 'init', '--bare'], wait=True)
+_git(args=['config', 'core.logallrefupdates', 'true'], wait=True)
+# create an empty blob (e69de29bb2d1d6434b8b29ae775ad8c2e48c5391)
+_git(args=['hash-object', '-w', '--stdin'], input='', wait=True)
+_git(
+args=[
+'commit', '--allow-empty', '-m', 'Start a new nmbug repository'
+],
+additional_env={'GIT_WORK_TREE': NMBGIT},
+wait=True)
+
+
 def checkout():
 
 Update the notmuch database from Git.
@@ -725,6 +744,7 @@ if __name__ == '__main__':
 'commit',
 'fetch',
 'help',
+'init',
 'log',
 'merge',
 'pull',
-- 
2.1.0.60.g85f0837

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


Re: [PATCH] doc: remove support for rst2man

2015-01-18 Thread W. Trevor King
Looks good to me :).

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] doc: Allow rst2man.py as an alternative to rst2man

2015-01-03 Thread W. Trevor King
On Sat, Jan 03, 2015 at 07:12:13PM +0200, Tomi Ollila wrote:
> ? so this makes me wonder whether there is actually anyone needing
> rst2man there?

Requiring Sphinx >= 1.0 (2010-07-23 [1]) to build man pages is fine
with me.

Cheers,
Trevor

[1]: https://pypi.python.org/pypi/Sphinx/1.0

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 



[PATCH] doc: Allow rst2man.py as an alternative to rst2man

2015-01-03 Thread W. Trevor King
On Sat, Jan 03, 2015 at 04:49:27PM +0100, David Bremner wrote:
> At the risk of bike-shedding, rewrite the configure check to be more
> "obvious". This is pretty subjective, but in particular I'm not a
> big fan of resetting RST2MAN at the bottom of every iteration of the
> for loop.  Also conform a bit more to the convention of using a
> lower case variable in configure and assigning it in Makefile.

I'm fine with all of these changes.

> @@ -854,6 +860,9 @@ HAVE_RST2MAN=${have_rst2man}
>  # Whether there's a doxygen binary available for building api documentation
>  HAVE_DOXYGEN=${have_doxygen}
>  
> +# The path to the rst2man program for building documentation.
> +RST2MAN = ${rst2man}
> +
>  # The directory to which desktop files should be installed
>  desktop_dir = \$(prefix)/share/applications
>  

I'd keep the RST2MAN entry right after HAVE_RST2MAN, instead of having
HAVE_DOXYGEN between them.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 



Re: [PATCH] doc: Allow rst2man.py as an alternative to rst2man

2015-01-03 Thread W. Trevor King
On Sat, Jan 03, 2015 at 04:49:27PM +0100, David Bremner wrote:
 At the risk of bike-shedding, rewrite the configure check to be more
 obvious. This is pretty subjective, but in particular I'm not a
 big fan of resetting RST2MAN at the bottom of every iteration of the
 for loop.  Also conform a bit more to the convention of using a
 lower case variable in configure and assigning it in Makefile.

I'm fine with all of these changes.

 @@ -854,6 +860,9 @@ HAVE_RST2MAN=${have_rst2man}
  # Whether there's a doxygen binary available for building api documentation
  HAVE_DOXYGEN=${have_doxygen}
  
 +# The path to the rst2man program for building documentation.
 +RST2MAN = ${rst2man}
 +
  # The directory to which desktop files should be installed
  desktop_dir = \$(prefix)/share/applications
  

I'd keep the RST2MAN entry right after HAVE_RST2MAN, instead of having
HAVE_DOXYGEN between them.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH v3] nmbug: Add an 'init' command

2014-11-29 Thread W. Trevor King
On Sat, Nov 29, 2014 at 12:09:17PM -0800, W. Trevor King wrote:
> On Sat, Nov 29, 2014 at 10:40:01AM +0100, Michal Sojka wrote:
> > On ?t, ??j 28 2014, W. Trevor King wrote:
> > > +_spawn(
> > > +args=['git', 'init', '--separate-git-dir', NMBGIT, workdir],
> > > +wait=True)
> > > +_git(args=['config', '--unset', 'core.worktree'], wait=True)
> > > +_git(args=['config', 'core.bare', 'true'], wait=True)
> > 
> > Why do you create a non-bare repository and then make it bare?
> 
> Bare repositories don't usually have upstream tracking branches.  See
> the commit message for c2001674 (nmbug: Add 'clone' and replace
> FETCH_HEAD with @{upstream}, 2014-03-09) for details [1].  I can
> resubmit this patch with a commit message that mentions the
> explanation in c2001674 if folks want the extra clarity here.

Ah, it seems that the lack of remote-tracking branches is unique to
'clone --bare'.  When I compare 'init --bare' with the above (using
Git 2.1.0), the only difference in the resulting repository is that
the the 'init --bare' form doesn't set core.logallrefupdates, while
the form above sets core.logallrefupdates to true.  I'll submit v4
using 'init --bare' and an explicit core.logallrefupdates config.

Cheers,
Trevor

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20141129/50a1281c/attachment.pgp>


[PATCH v3] nmbug: Add an 'init' command

2014-11-29 Thread W. Trevor King
On Sat, Nov 29, 2014 at 10:40:01AM +0100, Michal Sojka wrote:
> On ?t, ??j 28 2014, W. Trevor King wrote:
> > +_spawn(
> > +args=['git', 'init', '--separate-git-dir', NMBGIT, workdir],
> > +wait=True)
> > +_git(args=['config', '--unset', 'core.worktree'], wait=True)
> > +_git(args=['config', 'core.bare', 'true'], wait=True)
> 
> Why do you create a non-bare repository and then make it bare?

Bare repositories don't usually have upstream tracking branches.  See
the commit message for c2001674 (nmbug: Add 'clone' and replace
FETCH_HEAD with @{upstream}, 2014-03-09) for details [1].  I can
resubmit this patch with a commit message that mentions the
explanation in c2001674 if folks want the extra clarity here.

Cheers,
Trevor

[1]: id:de7dd9d4021cd17350df4423bc13f3da35f2b324.1394410765.git.wking at 
tremily.us
 http://thread.gmane.org/gmane.mail.notmuch.general/17457

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: 
<http://notmuchmail.org/pipermail/notmuch/attachments/20141129/79b6d535/attachment.pgp>


Re: [PATCH v3] nmbug: Add an 'init' command

2014-11-29 Thread W. Trevor King
On Sat, Nov 29, 2014 at 10:40:01AM +0100, Michal Sojka wrote:
 On Út, říj 28 2014, W. Trevor King wrote:
  +_spawn(
  +args=['git', 'init', '--separate-git-dir', NMBGIT, workdir],
  +wait=True)
  +_git(args=['config', '--unset', 'core.worktree'], wait=True)
  +_git(args=['config', 'core.bare', 'true'], wait=True)
 
 Why do you create a non-bare repository and then make it bare?

Bare repositories don't usually have upstream tracking branches.  See
the commit message for c2001674 (nmbug: Add 'clone' and replace
FETCH_HEAD with @{upstream}, 2014-03-09) for details [1].  I can
resubmit this patch with a commit message that mentions the
explanation in c2001674 if folks want the extra clarity here.

Cheers,
Trevor

[1]: id:de7dd9d4021cd17350df4423bc13f3da35f2b324.1394410765.git.wk...@tremily.us
 http://thread.gmane.org/gmane.mail.notmuch.general/17457

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy


signature.asc
Description: OpenPGP digital signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


  1   2   3   4   5   >