filelog: drop index attribute (API)
The previous commit removed the last consumer of the "index" attribute
on the file storage interface. The index is an extremely low-level
data structure that is revlog specific and isn't appropriate to
expose as part of a generic storage API. There may be a market for
an efficient data structure to obtain metadata on every revision for
a file. But if there is, it should be designed using e.g. named
attributes for lookup instead of a list-like of 8-tuples.
Let's drop the attribute from filelog and remove the attribute from
the file storage interface.
Differential Revision: https://phab.mercurial-scm.org/D4720
--- a/mercurial/filelog.py Mon Sep 24 09:38:27 2018 -0700
+++ b/mercurial/filelog.py Thu Sep 20 19:31:07 2018 -0700
@@ -25,8 +25,6 @@
# Full name of the user visible file, relative to the repository root.
# Used by LFS.
self._revlog.filename = path
- # Used by repo upgrade.
- self.index = self._revlog.index
# Used by changegroup generation.
self._generaldelta = self._revlog._generaldelta
--- a/mercurial/repository.py Mon Sep 24 09:38:27 2018 -0700
+++ b/mercurial/repository.py Thu Sep 20 19:31:07 2018 -0700
@@ -485,9 +485,6 @@
* DAG data (storing and querying the relationship between nodes).
* Metadata to facilitate storage.
"""
- index = interfaceutil.Attribute(
- """An ``ifilerevisionssequence`` instance.""")
-
def __len__():
"""Obtain the number of revisions stored for this file."""
--- a/tests/simplestorerepo.py Mon Sep 24 09:38:27 2018 -0700
+++ b/tests/simplestorerepo.py Thu Sep 20 19:31:07 2018 -0700
@@ -103,7 +103,7 @@
self._indexdata = indexdata or []
self._indexbynode = {}
self._indexbyrev = {}
- self.index = []
+ self._index = []
self._refreshindex()
# This is used by changegroup code :/
@@ -112,7 +112,7 @@
def _refreshindex(self):
self._indexbynode.clear()
self._indexbyrev.clear()
- self.index = []
+ self._index = []
for i, entry in enumerate(self._indexdata):
self._indexbynode[entry[b'node']] = entry
@@ -138,10 +138,10 @@
p1rev, p2rev = self.parentrevs(self.rev(entry[b'node']))
# start, length, rawsize, chainbase, linkrev, p1, p2, node
- self.index.append((0, 0, 0, -1, entry[b'linkrev'], p1rev, p2rev,
- entry[b'node']))
+ self._index.append((0, 0, 0, -1, entry[b'linkrev'], p1rev, p2rev,
+ entry[b'node']))
- self.index.append((0, 0, 0, -1, -1, -1, -1, nullid))
+ self._index.append((0, 0, 0, -1, -1, -1, -1, nullid))
def __len__(self):
return len(self._indexdata)