store: introduce a main_file_path method for revlog
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 15 May 2023 09:02:09 +0200
changeset 50492 3473d18c029a
parent 50491 5f636e0fec4a
child 50493 816e8bc6e066
store: introduce a main_file_path method for revlog This help code that need to point revlog to an index file. This is put to use in the upgrade code.
mercurial/store.py
mercurial/upgrade_utils/engine.py
--- a/mercurial/store.py	Mon May 15 09:01:53 2023 +0200
+++ b/mercurial/store.py	Mon May 15 09:02:09 2023 +0200
@@ -524,6 +524,10 @@
         self.target_id = target_id
         self.is_revlog_main = is_revlog_main
 
+    def main_file_path(self):
+        """unencoded path of the main revlog file"""
+        return self.unencoded_path
+
 
 @attr.s(slots=True)
 class StoreFile:
--- a/mercurial/upgrade_utils/engine.py	Mon May 15 09:01:53 2023 +0200
+++ b/mercurial/upgrade_utils/engine.py	Mon May 15 09:02:09 2023 +0200
@@ -90,7 +90,7 @@
         util.copyfile(olddata, newdata)
 
     if entry.revlog_type & store.FILEFLAGS_FILELOG:
-        unencodedname = entry.unencoded_path
+        unencodedname = entry.main_file_path()
         destrepo.svfs.fncache.add(unencodedname)
         if copydata:
             destrepo.svfs.fncache.add(unencodedname[:-2] + b'.d')
@@ -132,7 +132,7 @@
 ):
     """returns the new revlog object created"""
     newrl = None
-    revlog_path = entry.unencoded_path
+    revlog_path = entry.main_file_path()
     if matchrevlog(upgrade_op.revlogs_to_process, entry.revlog_type):
         ui.note(
             _(b'cloning %d revisions from %s\n')