##// END OF EJS Templates
dagutil: use revlog.parentrevs() for resolving parent revisions...
Gregory Szorc -
r39216:8de52699 default
parent child Browse files
Show More
@@ -20,21 +20,6 b' class revlogdag(object):'
20 def __init__(self, revlog):
20 def __init__(self, revlog):
21 self._revlog = revlog
21 self._revlog = revlog
22
22
23 def parents(self, ix):
24 rlog = self._revlog
25 idx = rlog.index
26 revdata = idx[ix]
27 prev = revdata[5]
28 if prev != nullrev:
29 prev2 = revdata[6]
30 if prev2 == nullrev:
31 return [prev]
32 return [prev, prev2]
33 prev2 = revdata[6]
34 if prev2 != nullrev:
35 return [prev2]
36 return []
37
38 def linearize(self, ixs):
23 def linearize(self, ixs):
39 '''linearize and topologically sort a list of revisions
24 '''linearize and topologically sort a list of revisions
40
25
@@ -45,7 +30,7 b' class revlogdag(object):'
45 parent, then adding the rev itself to the output list.
30 parent, then adding the rev itself to the output list.
46 '''
31 '''
47 sorted = []
32 sorted = []
48 visit = list(dagop.headrevs(ixs, self.parents))
33 visit = list(dagop.headrevs(ixs, self._revlog.parentrevs))
49 visit.sort(reverse=True)
34 visit.sort(reverse=True)
50 finished = set()
35 finished = set()
51
36
@@ -58,7 +43,7 b' class revlogdag(object):'
58 finished.add(cur)
43 finished.add(cur)
59 else:
44 else:
60 visit.append(-cur - 1)
45 visit.append(-cur - 1)
61 visit += [p for p in self.parents(cur)
46 visit += [p for p in self._revlog.parentrevs(cur)
62 if p in ixs and p not in finished]
47 if p != nullrev and p in ixs and p not in finished]
63 assert len(sorted) == len(ixs)
48 assert len(sorted) == len(ixs)
64 return sorted
49 return sorted
General Comments 0
You need to be logged in to leave comments. Login now