Export to GitHub

django-rcsfield - issue #9

GitBackend: get_revisions returns reivisions sorted incorrectly


Posted on Dec 17, 2008 by Happy Horse

http://code.google.com/p/django-rcsfield/source/browse/trunk/rcsfield/backends/gitcore.py#78

I assume that get_revisions should return the latest commits - sorted by date of commit (new commits first, old commits last) ... right now it's sorting on commit id? For me this is unexpected... repo.log(path=key) already returns the commits in sorted order...

Fix something like this:

def get_revisions(self, key): """ returns a list with all revisions at which key was changed. Revision Numbers are integers starting at 1.

"""
repo = Repo(self.repo_path)
crevs = [r.id for r in repo.log(path=key)]
# crevs.sort(reverse=True)
return crevs[1:] # cut off the head revision-number

Comment #1

Posted on Dec 17, 2008 by Happy Panda

Your assumption is correct. It should return commit-ids sorted with new commits first and old commits last. Thank you for reporting.

Comment #2

Posted on Dec 17, 2008 by Swift Panda

(No comment was entered for this change.)

Comment #3

Posted on Mar 4, 2009 by Swift Panda

Fixed in r71

Status: Fixed

Labels:
Type-Defect Priority-High