X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=devel%2Fnmbug%2Fnmbug;h=c0e7c3c69cc635c6cf89328adf750e78faeef47f;hp=932ec12d41b9245387e89bc3ca0810f05251ad18;hb=0a1558471f70ec8591c9d40808d1ffd930742054;hpb=9d25c97d8b4464e65f8bd6705db47603c94af275 diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug index 932ec12d..c0e7c3c6 100755 --- a/devel/nmbug/nmbug +++ b/devel/nmbug/nmbug @@ -14,7 +14,7 @@ # 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/ . +# along with this program. If not, see https://www.gnu.org/licenses/ . """ Manage notmuch tags with Git @@ -80,7 +80,7 @@ except AttributeError: # Python < 3.2 See PEP 343 for details on context managers [1]. - [1]: http://legacy.python.org/dev/peps/pep-0343/ + [1]: https://www.python.org/dev/peps/pep-0343/ """ def __init__(self, **kwargs): self.name = _tempfile.mkdtemp(**kwargs) @@ -119,9 +119,9 @@ def _xapian_quote(string): Xapian uses double-quotes for quoting strings. You can escape internal quotes by repeating them [1,2,3]. - [1]: http://trac.xapian.org/ticket/128#comment:2 - [2]: http://trac.xapian.org/ticket/128#comment:17 - [3]: http://trac.xapian.org/changeset/13823/svn + [1]: https://trac.xapian.org/ticket/128#comment:2 + [2]: https://trac.xapian.org/ticket/128#comment:17 + [3]: https://trac.xapian.org/changeset/13823/svn """ return '"{0}"'.format(string.replace('"', '""')) @@ -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) @@ -306,8 +308,9 @@ 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) def _is_committed(status): @@ -474,7 +477,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() @@ -607,6 +610,8 @@ def _index_tags(): stdin=_subprocess.PIPE, additional_env={'GIT_INDEX_FILE': path}) as git: for line in notmuch.stdout: + if line.strip().startswith('#'): + continue (tags_string, id) = [_.strip() for _ in line.split(' -- id:')] tags = [ _unquote(tag[len(prefix):])