aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp/git/repository.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-12-27 18:27:57 +0100
committerGuido Günther <agx@sigxcpu.org>2011-12-27 19:13:59 +0100
commit361449bb51deb7010701001b3dee0cbdaef746a5 (patch)
treed0f0b4b14b940c1c01a5e298fc4a18c5d1cd3076 /gbp/git/repository.py
parentf9ca26405c53a6ad829e1bcf4f60c5a6bb4ae4d9 (diff)
GitRepository: Use GitArgs in get_commits
Diffstat (limited to 'gbp/git/repository.py')
-rw-r--r--gbp/git/repository.py30
1 files changed, 10 insertions, 20 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index aca9cdb9..58d67bec 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -898,27 +898,17 @@ class GitRepository(object):
merge commit
@type first_parent: C{bool}
"""
+ args = GitArgs('--pretty=format:%H')
+ args.add_true(num, '-%d' % num)
+ args.add_true(first_parent, '--first-parent')
+ args.add_true(since and until, '%s..%s' % (since, until))
+ args.add_cond(options, options)
+ args.add("--")
+ if isinstance(paths, basestring):
+ paths = [ paths ]
+ args.add_cond(paths, paths)
- args = ['--pretty=format:%H']
-
- if options:
- args += options
-
- if num:
- args += [ '-%d' % num ]
-
- if first_parent:
- args += [ "--first-parent" ]
-
- if since and until:
- args += ['%s..%s' % (since, until)]
-
- if paths:
- if isinstance(paths, basestring):
- paths = [ paths ]
- args += [ "--" ] + paths
-
- commits, ret = self.__git_getoutput('log', args)
+ commits, ret = self.__git_getoutput('log', args.args)
if ret:
where = " on %s" % paths if paths else ""
raise GitRepositoryError, ("Error getting commits %s..%s%s" %