Mercurial > hg
comparison mercurial/copies.py @ 8209:a1a5a57efe90
replace util.sort with sorted built-in
This is marginally faster for small and moderately-sized lists
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 26 Apr 2009 16:50:44 -0500 |
parents | 08e1baf924ca |
children | 46293a0c7e9f |
comparison
equal
deleted
inserted
replaced
8208:32a2a1e244f1 | 8209:a1a5a57efe90 |
---|---|
8 from i18n import _ | 8 from i18n import _ |
9 import util, heapq | 9 import util, heapq |
10 | 10 |
11 def _nonoverlap(d1, d2, d3): | 11 def _nonoverlap(d1, d2, d3): |
12 "Return list of elements in d1 not in d2 or d3" | 12 "Return list of elements in d1 not in d2 or d3" |
13 return util.sort([d for d in d1 if d not in d3 and d not in d2]) | 13 return sorted([d for d in d1 if d not in d3 and d not in d2]) |
14 | 14 |
15 def _dirname(f): | 15 def _dirname(f): |
16 s = f.rfind("/") | 16 s = f.rfind("/") |
17 if s == -1: | 17 if s == -1: |
18 return "" | 18 return "" |
44 if fc.rev() < limit and fc.rev() is not None: | 44 if fc.rev() < limit and fc.rev() is not None: |
45 continue | 45 continue |
46 visit += [(p, depth - 1) for p in fc.parents()] | 46 visit += [(p, depth - 1) for p in fc.parents()] |
47 | 47 |
48 # return old names sorted by depth | 48 # return old names sorted by depth |
49 return [o[1] for o in util.sort(old.values())] | 49 return [o[1] for o in sorted(old.values())] |
50 | 50 |
51 def _findlimit(repo, a, b): | 51 def _findlimit(repo, a, b): |
52 "find the earliest revision that's an ancestor of a or b but not both" | 52 "find the earliest revision that's an ancestor of a or b but not both" |
53 # basic idea: | 53 # basic idea: |
54 # - mark a and b with different sides | 54 # - mark a and b with different sides |