D3723: cvsps: avoid comparison between None and a tuple in date sorting
This revision was automatically updated to reflect the committed changes. Closed by commit rHG80f6e95fac2d: cvsps: avoid comparison between None and a tuple in date sorting (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3723?vs=9035=9044 REVISION DETAIL https://phab.mercurial-scm.org/D3723 AFFECTED FILES hgext/convert/cvsps.py CHANGE DETAILS diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -567,11 +567,15 @@ mindate = {} for e in log: if e.commitid: -mindate[e.commitid] = min(e.date, mindate.get(e.commitid)) +if e.commitid not in mindate: +mindate[e.commitid] = e.date +else: +mindate[e.commitid] = min(e.date, mindate[e.commitid]) # Merge changesets -log.sort(key=lambda x: (mindate.get(x.commitid), x.commitid, x.comment, -x.author, x.branch, x.date, x.branchpoints)) +log.sort(key=lambda x: (mindate.get(x.commitid, (-1, 0)), +x.commitid or '', x.comment, +x.author, x.branch or '', x.date, x.branchpoints)) changesets = [] files = set() To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3723: cvsps: avoid comparison between None and a tuple in date sorting
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Avoids badness on Python 3. I had to figure out which entries in this object *could* be None experimentally, but I think I've got them all now. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3723 AFFECTED FILES hgext/convert/cvsps.py CHANGE DETAILS diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -567,11 +567,15 @@ mindate = {} for e in log: if e.commitid: -mindate[e.commitid] = min(e.date, mindate.get(e.commitid)) +if e.commitid not in mindate: +mindate[e.commitid] = e.date +else: +mindate[e.commitid] = min(e.date, mindate[e.commitid]) # Merge changesets -log.sort(key=lambda x: (mindate.get(x.commitid), x.commitid, x.comment, -x.author, x.branch, x.date, x.branchpoints)) +log.sort(key=lambda x: (mindate.get(x.commitid, (-1, 0)), +x.commitid or '', x.comment, +x.author, x.branch or '', x.date, x.branchpoints)) changesets = [] files = set() To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel