changeset 51525:cebd96dee99a

branchcache: move the filename to a class attribute This prepare the introduction of more variant of cache.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 25 Feb 2024 20:40:37 +0100
parents 077d5a784c58
children 47752632b4fc
files mercurial/branchmap.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/branchmap.py	Tue Feb 27 22:52:00 2024 +0100
+++ b/mercurial/branchmap.py	Sun Feb 25 20:40:37 2024 +0100
@@ -406,6 +406,8 @@
 class branchcache(_BaseBranchCache):
     """Branchmap info for a local repo or repoview"""
 
+    _base_filename = b"branch2"
+
     def __init__(
         self,
         repo: "localrepo.localrepository",
@@ -525,10 +527,10 @@
             if state == b'c':
                 self._closednodes.add(node)
 
-    @staticmethod
-    def _filename(repo):
+    @classmethod
+    def _filename(cls, repo):
         """name of a branchcache file for a given repo or repoview"""
-        filename = b"branch2"
+        filename = cls._base_filename
         if repo.filtername:
             filename = b'%s-%s' % (filename, repo.filtername)
         return filename