# HG changeset patch # User Pierre-Yves David # Date 2024-02-25 19:40:37 # Node ID cebd96dee99abb2c26f2ccdfa17016ae3f653838 # Parent 077d5a784c58b34af41211c34d7dca9d5d3f1c53 branchcache: move the filename to a class attribute This prepare the introduction of more variant of cache. diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -406,6 +406,8 @@ class _BaseBranchCache: 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 @@ class branchcache(_BaseBranchCache): 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