Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHGfe148d7544a4: cvsps: wrap cmp methods (deprecated) in functools.cmp_to_key
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
indygreg |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | hgext/convert/cvsps.py (5 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Augie Fackler | Apr 27 2018, 1:24 AM |
Status | Author | Revision | |
---|---|---|---|
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 |
# Mercurial built-in replacement for cvsps. | # Mercurial built-in replacement for cvsps. | ||||
# | # | ||||
# Copyright 2008, Frank Kingswood <frank@kingswood-consulting.co.uk> | # Copyright 2008, Frank Kingswood <frank@kingswood-consulting.co.uk> | ||||
# | # | ||||
# This software may be used and distributed according to the terms of the | # This software may be used and distributed according to the terms of the | ||||
# GNU General Public License version 2 or any later version. | # GNU General Public License version 2 or any later version. | ||||
from __future__ import absolute_import | from __future__ import absolute_import | ||||
import functools | |||||
import os | import os | ||||
import re | import re | ||||
from mercurial.i18n import _ | from mercurial.i18n import _ | ||||
from mercurial import ( | from mercurial import ( | ||||
encoding, | encoding, | ||||
error, | error, | ||||
hook, | hook, | ||||
return +1 | return +1 | ||||
elif l[i] < r[i]: | elif l[i] < r[i]: | ||||
return -1 | return -1 | ||||
elif l[i] > r[i]: | elif l[i] > r[i]: | ||||
return +1 | return +1 | ||||
return 0 | return 0 | ||||
for c in changesets: | for c in changesets: | ||||
c.entries.sort(entitycompare) | c.entries.sort(key=functools.cmp_to_key(entitycompare)) | ||||
# Sort changesets by date | # Sort changesets by date | ||||
odd = set() | odd = set() | ||||
def cscmp(l, r): | def cscmp(l, r): | ||||
d = sum(l.date) - sum(r.date) | d = sum(l.date) - sum(r.date) | ||||
if d: | if d: | ||||
return d | return d | ||||
if not d: | if not d: | ||||
d = c([e.file for e in l.entries], [e.file for e in r.entries]) | d = c([e.file for e in l.entries], [e.file for e in r.entries]) | ||||
# Try and put changes without a branch point before ones with | # Try and put changes without a branch point before ones with | ||||
# a branch point. | # a branch point. | ||||
if not d: | if not d: | ||||
d = c(len(l.branchpoints), len(r.branchpoints)) | d = c(len(l.branchpoints), len(r.branchpoints)) | ||||
return d | return d | ||||
changesets.sort(cscmp) | changesets.sort(key=functools.cmp_to_key(cscmp)) | ||||
# Collect tags | # Collect tags | ||||
globaltags = {} | globaltags = {} | ||||
for c in changesets: | for c in changesets: | ||||
for e in c.entries: | for e in c.entries: | ||||
for tag in e.tags: | for tag in e.tags: | ||||
# remember which is the latest changeset to have this tag | # remember which is the latest changeset to have this tag |