Mercurial > hg > hg-git
changeset 284:12cfa77a2ab0
sort heads by commit date in topological sort
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Wed, 24 Feb 2010 17:21:25 +0100 |
parents | 90458271e374 |
children | 5e5aee9b32d4 |
files | hggit/git_handler.py |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -369,6 +369,13 @@ seenheads.add(sha) todo.append(sha) + # sort by commit date + def commitdate(sha): + obj = self.git.get_object(sha) + return obj.commit_time-obj.commit_timezone + + todo.sort(key=commitdate, reverse=True) + # traverse the heads getting a list of all the unique commits commits = [] seen = set(todo)