summaryrefslogtreecommitdiff
path: root/gbp
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2009-08-15 18:58:18 +0200
committerGuido Günther <agx@sigxcpu.org>2009-08-15 19:14:25 +0200
commit080b1eb0f59091bf5a3ebd180b68839706615fb5 (patch)
tree8f34e96b5fb7cfde8e0362a0df1b6b24a723f7eb /gbp
parentd6dae624d35719556257043ce2212cd40511848f (diff)
make parameters for GitRepository.commits() optional
Diffstat (limited to 'gbp')
-rw-r--r--gbp/git_utils.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/gbp/git_utils.py b/gbp/git_utils.py
index b6e4b35..d89f778 100644
--- a/gbp/git_utils.py
+++ b/gbp/git_utils.py
@@ -103,13 +103,26 @@ class GitRepository(object):
else:
return []
- def commits(self, start, end, paths, options):
+ def commits(self, since=None, until=None, paths=None, options=None):
"""get commits from start to end touching pathds"""
+
+ if since or until:
+ range = ['%s..%s' % (since, until)]
+ else:
+ range = []
+
+ if paths:
+ paths = [ "--", paths ]
+ else:
+ paths = []
+
commits, ret = self.__git_getoutput('log',
- ['--pretty=format:%H'] + options +
- ['%s..%s' % (start, end), '--', paths])
+ ['--pretty=format:%H'] +
+ options +
+ range +
+ paths)
if ret:
- raise GitRepositoryError, "Error getting commits %s..%s%s" % (start, end, ["", " on %s" % paths][len(paths) > 0] )
+ raise GitRepositoryError, "Error getting commits %s..%s%s" % (since, until,["", " on %s" % paths][len(paths) > 0] )
return [ commit.strip() for commit in commits[::-1] ]
def show(self, id):