mercurial/store.py
changeset 50627 e1ee6910f6bc
parent 50514 0925eaf09c8b
child 50628 3ea3767c23a4
--- a/mercurial/store.py	Mon May 29 02:22:20 2023 +0200
+++ b/mercurial/store.py	Sat May 27 04:01:17 2023 +0200
@@ -19,6 +19,7 @@
 from . import (
     changelog,
     error,
+    filelog,
     manifest,
     policy,
     pycompat,
@@ -545,6 +546,21 @@
             files.append(StoreFile(unencoded_path=path, **data))
         return files
 
+    def get_revlog_instance(self, repo):
+        """Obtain a revlog instance from this store entry
+
+        An instance of the appropriate class is returned.
+        """
+        if self.is_changelog:
+            return changelog.changelog(repo.svfs)
+        elif self.is_manifestlog:
+            mandir = self.target_id.rstrip(b'/')
+            return manifest.manifestrevlog(
+                repo.nodeconstants, repo.svfs, tree=mandir
+            )
+        else:
+            return filelog.filelog(repo.svfs, self.target_id)
+
 
 @attr.s(slots=True)
 class StoreFile: