comparison mercurial/copies.py @ 6762:f67d1468ac50

util: add sort helper
author Matt Mackall <mpm@selenic.com>
date Fri, 27 Jun 2008 18:28:45 -0500
parents fb42030d79d6
children 4dd7b28003d2
comparison
equal deleted inserted replaced
6761:cb981fc955fb 6762:f67d1468ac50
9 from i18n import _ 9 from i18n import _
10 import util, heapq 10 import util, heapq
11 11
12 def _nonoverlap(d1, d2, d3): 12 def _nonoverlap(d1, d2, d3):
13 "Return list of elements in d1 not in d2 or d3" 13 "Return list of elements in d1 not in d2 or d3"
14 l = [d for d in d1 if d not in d3 and d not in d2] 14 return util.sort([d for d in d1 if d not in d3 and d not in d2])
15 l.sort()
16 return l
17 15
18 def _dirname(f): 16 def _dirname(f):
19 s = f.rfind("/") 17 s = f.rfind("/")
20 if s == -1: 18 if s == -1:
21 return "" 19 return ""
47 if fc.rev() < limit and fc.rev() is not None: 45 if fc.rev() < limit and fc.rev() is not None:
48 continue 46 continue
49 visit += [(p, depth - 1) for p in fc.parents()] 47 visit += [(p, depth - 1) for p in fc.parents()]
50 48
51 # return old names sorted by depth 49 # return old names sorted by depth
52 old = old.values() 50 return [o[1] for o in util.sort(old.values())]
53 old.sort()
54 return [o[1] for o in old]
55 51
56 def _findlimit(repo, a, b): 52 def _findlimit(repo, a, b):
57 "find the earliest revision that's an ancestor of a or b but not both" 53 "find the earliest revision that's an ancestor of a or b but not both"
58 # basic idea: 54 # basic idea:
59 # - mark a and b with different sides 55 # - mark a and b with different sides