From 361449bb51deb7010701001b3dee0cbdaef746a5 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Tue, 27 Dec 2011 18:27:57 +0100 Subject: GitRepository: Use GitArgs in get_commits --- gbp/git/repository.py | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) (limited to 'gbp/git/repository.py') 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" % -- cgit v1.2.3