diff options
author | Guido Günther <agx@sigxcpu.org> | 2013-04-27 00:12:26 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2013-04-27 00:12:26 +0200 |
commit | 3fd12f4e334f62ed1d129e1330a10a1a1cf4aeb8 (patch) | |
tree | 44e4a512e67f0188d0f97059c8cada0c360d294f | |
parent | 3c9d10e04c1604a4b6846154941528daba2bcffb (diff) |
Silence GitRepository.grep_log
None of the gbp script rely on the output being printed. In fact we
improve the exception by appending the stderr output.
-rw-r--r-- | gbp/git/repository.py | 11 | ||||
-rw-r--r-- | tests/test_GitRepository.py | 4 |
2 files changed, 10 insertions, 5 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py index 1c8ea9c..b1e7795 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -1349,10 +1349,15 @@ class GitRepository(object): args.append(since) args.append('--') - commits, ret = self._git_getoutput('log', args) + stdout, stderr, ret = self._git_inout('log', args, + capture_stderr=True) if ret: - raise GitRepositoryError("Error grepping log for %s" % regex) - return [ commit.strip() for commit in commits[::-1] ] + raise GitRepositoryError("Error grepping log for %s: %s" % + (regex, stderr[:-1])) + if stdout: + return [ commit.strip() for commit in stdout.split('\n')[::-1] ] + else: + return [] def get_subject(self, commit): """ diff --git a/tests/test_GitRepository.py b/tests/test_GitRepository.py index 37b50f8..7365dd8 100644 --- a/tests/test_GitRepository.py +++ b/tests/test_GitRepository.py @@ -695,7 +695,7 @@ def test_gc(): >>> repo.collect_garbage() """ -def test_grep(): +def test_grep_log(): """ Test grepping through commit messages @@ -714,7 +714,7 @@ def test_grep(): >>> repo.grep_log('foo', 'doesnotexist') Traceback (most recent call last): ... - GitRepositoryError: Error grepping log for foo + GitRepositoryError: Error grepping log for foo: fatal: bad revision 'doesnotexist' """ def test_is_ff(): |