revlog: add attribute on revlogs that specifies its kind
authorRaphaël Gomès <rgomes@octobus.net>
Wed, 10 Mar 2021 19:33:18 +0100
changeset 46714 f63299ee7e4d
parent 46713 bc2519513ae0
child 46715 45f0d5297698
revlog: add attribute on revlogs that specifies its kind The sidedata logic needs to check whether the revlog it's working on is a changelog, a manifest or a filelog. Furthermore, future versions of the revlog format will most likely see a split between the three types (i.e. they will store different information), so having this will be useful for other future endeavors as well. Differential Revision: https://phab.mercurial-scm.org/D10151
mercurial/changelog.py
mercurial/filelog.py
mercurial/manifest.py
--- a/mercurial/changelog.py	Fri Feb 19 10:53:27 2021 +0100
+++ b/mercurial/changelog.py	Wed Mar 10 19:33:18 2021 +0100
@@ -428,6 +428,7 @@
         self._filteredrevs = frozenset()
         self._filteredrevs_hashcache = {}
         self._copiesstorage = opener.options.get(b'copies-storage')
+        self.revlog_kind = b'changelog'
 
     @property
     def filteredrevs(self):
--- a/mercurial/filelog.py	Fri Feb 19 10:53:27 2021 +0100
+++ b/mercurial/filelog.py	Wed Mar 10 19:33:18 2021 +0100
@@ -32,6 +32,7 @@
         # Full name of the user visible file, relative to the repository root.
         # Used by LFS.
         self._revlog.filename = path
+        self._revlog.revlog_kind = b'filelog'
 
     def __len__(self):
         return len(self._revlog)
--- a/mercurial/manifest.py	Fri Feb 19 10:53:27 2021 +0100
+++ b/mercurial/manifest.py	Wed Mar 10 19:33:18 2021 +0100
@@ -1610,6 +1610,7 @@
         self.index = self._revlog.index
         self.version = self._revlog.version
         self._generaldelta = self._revlog._generaldelta
+        self._revlog.revlog_kind = b'manifest'
 
     def _setupmanifestcachehooks(self, repo):
         """Persist the manifestfulltextcache on lock release"""