Mercurial > public > mercurial-scm > hg-stable
diff hgext/convert/cvsps.py @ 9032:1fa80c5428b8
compat: use 'key' argument instead of 'cmp' when sorting a list
author | Alejandro Santos <alejolp@alejolp.com> |
---|---|
date | Sun, 05 Jul 2009 11:02:00 +0200 |
parents | 3b76321aa0de |
children | 4c041f1ee1b4 |
line wrap: on
line diff
--- a/hgext/convert/cvsps.py Sun Jul 05 11:01:30 2009 +0200 +++ b/hgext/convert/cvsps.py Sun Jul 05 11:02:00 2009 +0200 @@ -12,13 +12,6 @@ from mercurial import util from mercurial.i18n import _ -def listsort(list, key): - "helper to sort by key in Python 2.3" - try: - list.sort(key=key) - except TypeError: - list.sort(lambda l, r: cmp(key(l), key(r))) - class logentry(object): '''Class logentry has the following attributes: .author - author name as CVS knows it @@ -419,7 +412,7 @@ if len(log) % 100 == 0: ui.status(util.ellipsis('%d %s' % (len(log), e.file), 80)+'\n') - listsort(log, key=lambda x:(x.rcs, x.revision)) + log.sort(key=lambda x: (x.rcs, x.revision)) # find parent revisions of individual files versions = {} @@ -435,7 +428,7 @@ if cache: if log: # join up the old and new logs - listsort(log, key=lambda x:x.date) + log.sort(key=lambda x: x.date) if oldlog and oldlog[-1].date >= log[0].date: raise logerror('Log cache overlaps with new log entries,' @@ -484,7 +477,7 @@ # Merge changesets - listsort(log, key=lambda x:(x.comment, x.author, x.branch, x.date)) + log.sort(key=lambda x: (x.comment, x.author, x.branch, x.date)) changesets = [] files = set()