Fix list_commits sort order.

It appears that with libgit2 v0.24.6 reverse causes it to list them
newest first. In 0.25.1 it lists them oldest first. On both versions
just using SortMode.TIME gives the desired result of oldest first.
This commit is contained in:
Brian C. Lane 2017-10-24 09:06:32 -07:00
parent afdb320266
commit 596f06d5c0
2 changed files with 2 additions and 2 deletions

View File

@ -568,7 +568,7 @@ def list_commits(repo, branch, filename):
:raises: Can raise errors from Ggit
"""
revwalk = Git.RevisionWalker.new(repo)
revwalk.set_sort_mode(Git.SortMode.TIME | Git.SortMode.REVERSE)
revwalk.set_sort_mode(Git.SortMode.TIME)
branch_ref = "refs/heads/%s" % branch
revwalk.push_ref(branch_ref)

View File

@ -188,7 +188,7 @@ class GitRecipesTest(unittest.TestCase):
commits = recipes.list_commits(self.repo, "master", "http-server.toml")
self.assertEqual(len(commits), 2, "Wrong number of commits: %s" % commits)
self.assertEqual(commits[1].message, "Recipe http-server.toml reverted to commit %s" % revert_to)
self.assertEqual(commits[0].message, "Recipe http-server.toml reverted to commit %s" % revert_to)
def test_10_tag_new_commit(self):
"""Test tagging a newer commit of a recipe"""