X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=devel%2Fnmbug%2Fnmbug;h=0cd911487a80b950090566cd4d3c41adfb91f484;hb=7ef3b65376b87829441736f04b3231021f561d84;hp=6febf16fde3f2eabd5eaa8671703911de239bff0;hpb=5a69aa14748162429c43ad5ff3d8b35779fff0d4;p=notmuch diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug index 6febf16f..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( @@ -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,9 +308,16 @@ 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) + 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):