Show More
@@ -70,10 +70,6 b' class filelog(object):' | |||
|
70 | 70 | def descendants(self, revs): |
|
71 | 71 | return self._revlog.descendants(revs) |
|
72 | 72 | |
|
73 | # Used by hgweb. | |
|
74 | def headrevs(self): | |
|
75 | return self._revlog.headrevs() | |
|
76 | ||
|
77 | 73 | def heads(self, start=None, stop=None): |
|
78 | 74 | return self._revlog.heads(start, stop) |
|
79 | 75 |
@@ -525,14 +525,6 b' class ifileindex(interfaceutil.Interface' | |||
|
525 | 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 | 528 | def heads(start=None, stop=None): |
|
537 | 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 | 131 | self.assertEqual(list(f.descendants([nullrev])), []) |
|
132 | 132 | |
|
133 | self.assertEqual(f.headrevs(), [nullrev]) | |
|
134 | 133 | self.assertEqual(f.heads(), [nullid]) |
|
135 | 134 | self.assertEqual(f.heads(nullid), [nullid]) |
|
136 | 135 | self.assertEqual(f.heads(None, [nullid]), [nullid]) |
@@ -215,8 +214,6 b' class ifileindextests(basetestcase):' | |||
|
215 | 214 | |
|
216 | 215 | self.assertEqual(list(f.descendants([0])), []) |
|
217 | 216 | |
|
218 | self.assertEqual(f.headrevs(), [0]) | |
|
219 | ||
|
220 | 217 | self.assertEqual(f.heads(), [node]) |
|
221 | 218 | self.assertEqual(f.heads(node), [node]) |
|
222 | 219 | self.assertEqual(f.heads(stop=[node]), [node]) |
@@ -327,8 +324,6 b' class ifileindextests(basetestcase):' | |||
|
327 | 324 | self.assertEqual(list(f.descendants([1])), [2]) |
|
328 | 325 | self.assertEqual(list(f.descendants([0, 1])), [1, 2]) |
|
329 | 326 | |
|
330 | self.assertEqual(f.headrevs(), [2]) | |
|
331 | ||
|
332 | 327 | self.assertEqual(f.heads(), [node2]) |
|
333 | 328 | self.assertEqual(f.heads(node0), [node2]) |
|
334 | 329 | self.assertEqual(f.heads(node1), [node2]) |
@@ -372,8 +367,6 b' class ifileindextests(basetestcase):' | |||
|
372 | 367 | self.assertEqual(list(f.descendants([0, 1])), [1, 2, 3, 4, 5]) |
|
373 | 368 | self.assertEqual(list(f.descendants([1, 3])), [2, 4]) |
|
374 | 369 | |
|
375 | self.assertEqual(f.headrevs(), [2, 4, 5]) | |
|
376 | ||
|
377 | 370 | self.assertEqual(f.heads(), [node2, node4, node5]) |
|
378 | 371 | self.assertEqual(f.heads(node0), [node2, node4, node5]) |
|
379 | 372 | self.assertEqual(f.heads(node1), [node2]) |
@@ -564,18 +564,6 b' class filestorage(object):' | |||
|
564 | 564 | revision=revision, |
|
565 | 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 | 567 | def heads(self, start=None, stop=None): |
|
580 | 568 | # This is copied from revlog.py. |
|
581 | 569 | if start is None and stop is None: |
@@ -628,8 +616,8 b' class filestorage(object):' | |||
|
628 | 616 | |
|
629 | 617 | heads = {} |
|
630 | 618 | futurelargelinkrevs = set() |
|
631 |
for head in self.head |
|
|
632 | headlinkrev = self.linkrev(head) | |
|
619 | for head in self.heads(): | |
|
620 | headlinkrev = self.linkrev(self.rev(head)) | |
|
633 | 621 | heads[head] = headlinkrev |
|
634 | 622 | if headlinkrev >= minlink: |
|
635 | 623 | futurelargelinkrevs.add(headlinkrev) |
General Comments 0
You need to be logged in to leave comments.
Login now