branchcache: stop storing a repository instance on the cache altogether
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 19 Feb 2024 11:59:56 +0100
changeset 51451 fd30c4301929
parent 51450 3aba79ce52a9
child 51452 5515876173ba
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.
mercurial/branchmap.py
--- 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()