Commit graph

61 commits

Author SHA1 Message Date
W. Trevor King
b7e6d2cc30 nmbug-status: Factor config-loading out into read_config
By isolating this peripheral handling, we make the core logic of
nmbug-status easier to read.
2014-02-10 21:09:16 -04:00
W. Trevor King
fd29d3f4fb nmbug-status: Decode Popen output using the user's locale
Avoid:

  $ ./nmbug-status --list-views
  Traceback (most recent call last):
    File "./nmbug-status", line 47, in <module>
      'cat-file', 'blob', sha1+':status-config.json'],
  TypeError: can't concat bytes to str

by explicitly converting the byte-stream read from Popen into a
Unicode string.  On Python 2, this conversion is str -> unicode; on
Python 3 it is bytes -> str.

_ENCODING is derived from the user's locale (or system default) in an
attempt to match Git's output encoding.  It may be more robust to skip
the encoding/decoding by using a Python wrapper like pygit2 [1] for
Git access.  That's a fairly heavy dependency though, and using the
locale will probably work.

[1]: http://www.pygit2.org/
2014-02-10 21:04:55 -04:00
W. Trevor King
ee6b5c372f nmbug-status: Use email.utils instead of rfc822
rfc822 has been deprecated since Python 2.3, and it's gone in
Python 3 [1].

[1]: http://docs.python.org/2/library/rfc822.html
2014-02-10 21:03:12 -04:00
W. Trevor King
a8b81adc8e nmbug-status: Convert to Python-3-compatible print functions
We shouldn't require folks to install Python 2 to run nmbug-status.
2014-02-10 20:52:23 -04:00
Jani Nikula
02cb7cf152 nmbug-status: only import notmuch when needed
Make it possible to use the script to query search views without
notmuch python bindings installed.
2013-04-06 08:36:34 -03:00
Jani Nikula
73fcfa861c nmbug-status: add support for querying the search views
Make it easy for scripts to read the views and corresponding searches.
2013-04-06 08:36:26 -03:00
David Bremner
16bf7b4b89 nmbug: allow empty prefix
Current code does not distinguish between an empty string in the
NMBPREFIX environment variable and the variable being undefined. This
makes it impossible to define an empty prefix, if, e.g. somebody wants
to dump all of their tags with nmbug.
2013-03-02 10:42:45 -04:00
David Bremner
f7a7f78aeb nmbug: replace hard-coded magic hash with git-hash-object
This is at least easier to understand than the magic hash. It may also
be a bit more robust, although it is hard to imagine these numbers
changing without many other changes in git.
2013-03-02 10:42:27 -04:00
David Bremner
17b468ac9f nmbug: use 'notmuch tag --batch'
This should be more robust with respect to tags with whitespace and
and other special characters. It also (hopefully) fixes a remaining
bug handling message-ids with whitespace.  It should also be
noticeably faster for large sets of changes since it does one exec per
change set as opposed to one exec per tag changed.
2013-03-02 10:42:16 -04:00
David Bremner
2ec4ea610c nmbug: use dump --format=batch-tag
This should make nmbug tolerate tags with whitespace and other special
characters it.  At the moment this relies on _not_ passing calls to
notmuch tag through the shell, which is a documented feature of perl's
system function.
2013-03-02 10:42:06 -04:00
David Bremner
41a29a8472 nmbug: move from contrib to devel
There seems to be consensus to use presence in contrib as
documentation of limited support by the notmuch developers; in fact
nmbug is pretty integrated into our current development process, so
devel seems more appropriate.
2013-02-16 07:54:33 -04:00