# HG changeset patch # User Gregory Szorc # Date 2018-09-19 02:26:44 # Node ID 979e9f124caa377fc9ecd4a31d1cd861d90359c9 # Parent be0f32ca267149825726befc2e596826e78813b2 filelog: stop proxying headrevs() (API) The previous commit removed the last user of this method. It is redundant with heads() and adds little to no value other than convenience. Let's nuke it. Differential Revision: https://phab.mercurial-scm.org/D4663 diff --git a/mercurial/filelog.py b/mercurial/filelog.py --- a/mercurial/filelog.py +++ b/mercurial/filelog.py @@ -70,10 +70,6 @@ class filelog(object): def descendants(self, revs): return self._revlog.descendants(revs) - # Used by hgweb. - def headrevs(self): - return self._revlog.headrevs() - def heads(self, start=None, stop=None): return self._revlog.heads(start, stop) diff --git a/mercurial/repository.py b/mercurial/repository.py --- a/mercurial/repository.py +++ b/mercurial/repository.py @@ -525,14 +525,6 @@ class ifileindex(interfaceutil.Interface If ``nullrev`` is in the set, this is equivalent to ``revs()``. """ - def headrevs(): - """Obtain a list of revision numbers that are DAG heads. - - The list is sorted oldest to newest. - - TODO determine if sorting is required. - """ - def heads(start=None, stop=None): """Obtain a list of nodes that are DAG heads, with control. diff --git a/mercurial/testing/storage.py b/mercurial/testing/storage.py --- a/mercurial/testing/storage.py +++ b/mercurial/testing/storage.py @@ -130,7 +130,6 @@ class ifileindextests(basetestcase): self.assertEqual(list(f.descendants([nullrev])), []) - self.assertEqual(f.headrevs(), [nullrev]) self.assertEqual(f.heads(), [nullid]) self.assertEqual(f.heads(nullid), [nullid]) self.assertEqual(f.heads(None, [nullid]), [nullid]) @@ -215,8 +214,6 @@ class ifileindextests(basetestcase): self.assertEqual(list(f.descendants([0])), []) - self.assertEqual(f.headrevs(), [0]) - self.assertEqual(f.heads(), [node]) self.assertEqual(f.heads(node), [node]) self.assertEqual(f.heads(stop=[node]), [node]) @@ -327,8 +324,6 @@ class ifileindextests(basetestcase): self.assertEqual(list(f.descendants([1])), [2]) self.assertEqual(list(f.descendants([0, 1])), [1, 2]) - self.assertEqual(f.headrevs(), [2]) - self.assertEqual(f.heads(), [node2]) self.assertEqual(f.heads(node0), [node2]) self.assertEqual(f.heads(node1), [node2]) @@ -372,8 +367,6 @@ class ifileindextests(basetestcase): self.assertEqual(list(f.descendants([0, 1])), [1, 2, 3, 4, 5]) self.assertEqual(list(f.descendants([1, 3])), [2, 4]) - self.assertEqual(f.headrevs(), [2, 4, 5]) - self.assertEqual(f.heads(), [node2, node4, node5]) self.assertEqual(f.heads(node0), [node2, node4, node5]) self.assertEqual(f.heads(node1), [node2]) diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py --- a/tests/simplestorerepo.py +++ b/tests/simplestorerepo.py @@ -564,18 +564,6 @@ class filestorage(object): revision=revision, delta=delta) - def headrevs(self): - # Assume all revisions are heads by default. - revishead = {rev: True for rev in self._indexbyrev} - - for rev, entry in self._indexbyrev.items(): - # Unset head flag for all seen parents. - revishead[self.rev(entry[b'p1'])] = False - revishead[self.rev(entry[b'p2'])] = False - - return [rev for rev, ishead in sorted(revishead.items()) - if ishead] - def heads(self, start=None, stop=None): # This is copied from revlog.py. if start is None and stop is None: @@ -628,8 +616,8 @@ class filestorage(object): heads = {} futurelargelinkrevs = set() - for head in self.headrevs(): - headlinkrev = self.linkrev(head) + for head in self.heads(): + headlinkrev = self.linkrev(self.rev(head)) heads[head] = headlinkrev if headlinkrev >= minlink: futurelargelinkrevs.add(headlinkrev)