diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2012-11-08 08:22:26 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2012-11-23 19:25:10 +0100 |
commit | 8bc79214f5e8dc4dfe8307a1caf8464464727493 (patch) | |
tree | bd41ed3ec68f40714f59e58a2ba14c6fbe722d3d /gbp | |
parent | 3678906db10415e1ff690c0fc9baba1fe1af1d97 (diff) |
GitRepository/get_commits: more flexible revision ranges
Support getting the complete history of an arbitrary commit-ish
(since=None, until=COMMIT-ISH). Formerly this was only possible for the
current git HEAD. Now, get_commits(since=None, until='COMMIT')
translates to 'git log COMMIT'.
Also, for consistency, add support for getting the history from an
arbitrary commit until the current HEAD (since=COMMIT-ISH, until=None).
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp')
-rw-r--r-- | gbp/git/repository.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py index 77b60ec..a855ac7 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -1257,7 +1257,10 @@ class GitRepository(object): 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)) + if since: + args.add("%s..%s" % (since, until or 'HEAD')) + elif until: + args.add(until) args.add_cond(options, options) args.add("--") if isinstance(paths, basestring): |