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 /tests/test_GitRepository.py | |
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 'tests/test_GitRepository.py')
-rw-r--r-- | tests/test_GitRepository.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_GitRepository.py b/tests/test_GitRepository.py index 5b9fc92..0e833b5 100644 --- a/tests/test_GitRepository.py +++ b/tests/test_GitRepository.py @@ -373,6 +373,16 @@ def test_get_commits(): True >>> len(repo.get_commits(num=1)) == 1 True + >>> commits2 = repo.get_commits(since='HEAD~1') + >>> len(commits2) == 1 + True + >>> commits2[0] == commits[0] + True + >>> commits2 = repo.get_commits(until='HEAD~1') + >>> len(commits2) == 1 + True + >>> commits2[0] == commits[-1] + True >>> repo.get_commits(paths=['foo', 'bar']) [] >>> repo.get_commits(paths=['testfile']) == commits |