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.
--- a/mercurial/branchmap.py Mon Feb 19 11:43:19 2024 +0100
+++ b/mercurial/branchmap.py Mon Feb 19 11:59:56 2024 +0100
@@ -60,8 +60,8 @@
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 @@
"""
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 @@
"""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 @@
)
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 @@
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()