aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-07-30 09:30:22 +0200
committerGuido Günther <agx@sigxcpu.org>2011-07-30 10:48:26 +0200
commit61b720359540801fde1465379c72e15e70fa4675 (patch)
tree858e404aa33e2ecfba819023640d638d750fafa1
parent3330dfa2b51c3f8a1ec39c9123f86d2e2f708a0e (diff)
Robustify gbp.git.commits()
Git-Dch: Ignore
-rw-r--r--gbp/git.py26
1 files changed, 12 insertions, 14 deletions
diff --git a/gbp/git.py b/gbp/git.py
index 83b7926..06264b4 100644
--- a/gbp/git.py
+++ b/gbp/git.py
@@ -267,26 +267,24 @@ class GitRepository(object):
return []
def commits(self, since=None, until=None, paths=None, options=None):
- """get commits from start to end touching pathds"""
+ """get commits from start to end touching paths"""
- if since or until:
- range = ['%s..%s' % (since, until)]
- else:
- range = []
+ args = ['--pretty=format:%H']
+
+ if options:
+ args += options
+
+ if since and until:
+ args += ['%s..%s' % (since, until)]
if paths:
- paths = [ "--", paths ]
- else:
- paths = []
+ args += [ "--", paths ]
- commits, ret = self.__git_getoutput('log',
- ['--pretty=format:%H'] +
- options +
- range +
- paths)
+ commits, ret = self.__git_getoutput('log', args)
if ret:
+ where = " on %s" % paths if paths else ""
raise GitRepositoryError, ("Error getting commits %s..%s%s" %
- (since, until,["", " on %s" % paths][len(paths) > 0] ))
+ (since, until, where))
return [ commit.strip() for commit in commits[::-1] ]
def show(self, id):