# HG changeset patch # User Pierre-Yves David # Date 2024-02-19 10:59:56 # Node ID fd30c4301929d3a66c55078d520cce571da8ce5c # Parent 3aba79ce52a94e03660dec262580febaa807e37f branchcache: stop storing a repository instance on the cache altogether We did not really needed it and we do not needs it anymore at all. So lets make things simpler for consistency and garbage collecting and stop storing it altogether. diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -60,8 +60,8 @@ class BranchMapCache: def __getitem__(self, repo): self.updatecache(repo) bcache = self._per_filter[repo.filtername] - assert bcache._repo.filtername == repo.filtername, ( - bcache._repo.filtername, + assert bcache._filtername == repo.filtername, ( + bcache._filtername, repo.filtername, ) return bcache @@ -80,8 +80,8 @@ class BranchMapCache: """ self.updatecache(repo) bcache = self._per_filter[repo.filtername] - assert bcache._repo.filtername == repo.filtername, ( - bcache._repo.filtername, + assert bcache._filtername == repo.filtername, ( + bcache._filtername, repo.filtername, ) bcache.write(repo) @@ -220,7 +220,7 @@ class branchcache: """hasnode is a function which can be used to verify whether changelog has a given node or not. If it's not provided, we assume that every node we have exists in changelog""" - self._repo = repo + self._filtername = repo.filtername self._delayed = False if tipnode is None: self.tipnode = repo.nullid @@ -435,8 +435,8 @@ class branchcache: ) def write(self, repo): - assert self._repo.filtername == repo.filtername, ( - self._repo.filtername, + assert self._filtername == repo.filtername, ( + self._filtername, repo.filtername, ) tr = repo.currenttransaction() @@ -483,8 +483,8 @@ class branchcache: missing heads, and a generator of nodes that are strictly a superset of heads missing, this function updates self to be correct. """ - assert self._repo.filtername == repo.filtername, ( - self._repo.filtername, + assert self._filtername == repo.filtername, ( + self._filtername, repo.filtername, ) starttime = util.timer()