Show More
@@ -70,10 +70,6 b' class filelog(object):' | |||||
70 | def descendants(self, revs): |
|
70 | def descendants(self, revs): | |
71 | return self._revlog.descendants(revs) |
|
71 | return self._revlog.descendants(revs) | |
72 |
|
72 | |||
73 | # Used by hgweb. |
|
|||
74 | def headrevs(self): |
|
|||
75 | return self._revlog.headrevs() |
|
|||
76 |
|
||||
77 | def heads(self, start=None, stop=None): |
|
73 | def heads(self, start=None, stop=None): | |
78 | return self._revlog.heads(start, stop) |
|
74 | return self._revlog.heads(start, stop) | |
79 |
|
75 |
@@ -525,14 +525,6 b' class ifileindex(interfaceutil.Interface' | |||||
525 | If ``nullrev`` is in the set, this is equivalent to ``revs()``. |
|
525 | If ``nullrev`` is in the set, this is equivalent to ``revs()``. | |
526 | """ |
|
526 | """ | |
527 |
|
527 | |||
528 | def headrevs(): |
|
|||
529 | """Obtain a list of revision numbers that are DAG heads. |
|
|||
530 |
|
||||
531 | The list is sorted oldest to newest. |
|
|||
532 |
|
||||
533 | TODO determine if sorting is required. |
|
|||
534 | """ |
|
|||
535 |
|
||||
536 | def heads(start=None, stop=None): |
|
528 | def heads(start=None, stop=None): | |
537 | """Obtain a list of nodes that are DAG heads, with control. |
|
529 | """Obtain a list of nodes that are DAG heads, with control. | |
538 |
|
530 |
@@ -130,7 +130,6 b' class ifileindextests(basetestcase):' | |||||
130 |
|
130 | |||
131 | self.assertEqual(list(f.descendants([nullrev])), []) |
|
131 | self.assertEqual(list(f.descendants([nullrev])), []) | |
132 |
|
132 | |||
133 | self.assertEqual(f.headrevs(), [nullrev]) |
|
|||
134 | self.assertEqual(f.heads(), [nullid]) |
|
133 | self.assertEqual(f.heads(), [nullid]) | |
135 | self.assertEqual(f.heads(nullid), [nullid]) |
|
134 | self.assertEqual(f.heads(nullid), [nullid]) | |
136 | self.assertEqual(f.heads(None, [nullid]), [nullid]) |
|
135 | self.assertEqual(f.heads(None, [nullid]), [nullid]) | |
@@ -215,8 +214,6 b' class ifileindextests(basetestcase):' | |||||
215 |
|
214 | |||
216 | self.assertEqual(list(f.descendants([0])), []) |
|
215 | self.assertEqual(list(f.descendants([0])), []) | |
217 |
|
216 | |||
218 | self.assertEqual(f.headrevs(), [0]) |
|
|||
219 |
|
||||
220 | self.assertEqual(f.heads(), [node]) |
|
217 | self.assertEqual(f.heads(), [node]) | |
221 | self.assertEqual(f.heads(node), [node]) |
|
218 | self.assertEqual(f.heads(node), [node]) | |
222 | self.assertEqual(f.heads(stop=[node]), [node]) |
|
219 | self.assertEqual(f.heads(stop=[node]), [node]) | |
@@ -327,8 +324,6 b' class ifileindextests(basetestcase):' | |||||
327 | self.assertEqual(list(f.descendants([1])), [2]) |
|
324 | self.assertEqual(list(f.descendants([1])), [2]) | |
328 | self.assertEqual(list(f.descendants([0, 1])), [1, 2]) |
|
325 | self.assertEqual(list(f.descendants([0, 1])), [1, 2]) | |
329 |
|
326 | |||
330 | self.assertEqual(f.headrevs(), [2]) |
|
|||
331 |
|
||||
332 | self.assertEqual(f.heads(), [node2]) |
|
327 | self.assertEqual(f.heads(), [node2]) | |
333 | self.assertEqual(f.heads(node0), [node2]) |
|
328 | self.assertEqual(f.heads(node0), [node2]) | |
334 | self.assertEqual(f.heads(node1), [node2]) |
|
329 | self.assertEqual(f.heads(node1), [node2]) | |
@@ -372,8 +367,6 b' class ifileindextests(basetestcase):' | |||||
372 | self.assertEqual(list(f.descendants([0, 1])), [1, 2, 3, 4, 5]) |
|
367 | self.assertEqual(list(f.descendants([0, 1])), [1, 2, 3, 4, 5]) | |
373 | self.assertEqual(list(f.descendants([1, 3])), [2, 4]) |
|
368 | self.assertEqual(list(f.descendants([1, 3])), [2, 4]) | |
374 |
|
369 | |||
375 | self.assertEqual(f.headrevs(), [2, 4, 5]) |
|
|||
376 |
|
||||
377 | self.assertEqual(f.heads(), [node2, node4, node5]) |
|
370 | self.assertEqual(f.heads(), [node2, node4, node5]) | |
378 | self.assertEqual(f.heads(node0), [node2, node4, node5]) |
|
371 | self.assertEqual(f.heads(node0), [node2, node4, node5]) | |
379 | self.assertEqual(f.heads(node1), [node2]) |
|
372 | self.assertEqual(f.heads(node1), [node2]) |
@@ -564,18 +564,6 b' class filestorage(object):' | |||||
564 | revision=revision, |
|
564 | revision=revision, | |
565 | delta=delta) |
|
565 | delta=delta) | |
566 |
|
566 | |||
567 | def headrevs(self): |
|
|||
568 | # Assume all revisions are heads by default. |
|
|||
569 | revishead = {rev: True for rev in self._indexbyrev} |
|
|||
570 |
|
||||
571 | for rev, entry in self._indexbyrev.items(): |
|
|||
572 | # Unset head flag for all seen parents. |
|
|||
573 | revishead[self.rev(entry[b'p1'])] = False |
|
|||
574 | revishead[self.rev(entry[b'p2'])] = False |
|
|||
575 |
|
||||
576 | return [rev for rev, ishead in sorted(revishead.items()) |
|
|||
577 | if ishead] |
|
|||
578 |
|
||||
579 | def heads(self, start=None, stop=None): |
|
567 | def heads(self, start=None, stop=None): | |
580 | # This is copied from revlog.py. |
|
568 | # This is copied from revlog.py. | |
581 | if start is None and stop is None: |
|
569 | if start is None and stop is None: | |
@@ -628,8 +616,8 b' class filestorage(object):' | |||||
628 |
|
616 | |||
629 | heads = {} |
|
617 | heads = {} | |
630 | futurelargelinkrevs = set() |
|
618 | futurelargelinkrevs = set() | |
631 |
for head in self.head |
|
619 | for head in self.heads(): | |
632 | headlinkrev = self.linkrev(head) |
|
620 | headlinkrev = self.linkrev(self.rev(head)) | |
633 | heads[head] = headlinkrev |
|
621 | heads[head] = headlinkrev | |
634 | if headlinkrev >= minlink: |
|
622 | if headlinkrev >= minlink: | |
635 | futurelargelinkrevs.add(headlinkrev) |
|
623 | futurelargelinkrevs.add(headlinkrev) |
General Comments 0
You need to be logged in to leave comments.
Login now