diff contrib/perf.py @ 41626:328ca3b9e545

branchmap: encapsulate cache updating in the map itself Rather than have a repository update the cache, move handling of cache updates into the branchmap module, in the form of a custom mapping class. This makes later performance improvements easier to handle too. Differential Revision: https://phab.mercurial-scm.org/D5638
author Martijn Pieters <mj@octobus.net>
date Mon, 21 Jan 2019 17:37:33 +0000
parents bf7fb97aecf1
children 6a447a3d1bd0
line wrap: on
line diff
--- a/contrib/perf.py	Thu Feb 07 21:16:25 2019 -0800
+++ b/contrib/perf.py	Mon Jan 21 17:37:33 2019 +0000
@@ -2376,13 +2376,18 @@
             view = repo
         else:
             view = repo.filtered(filtername)
+        if util.safehasattr(view._branchcaches, '_per_filter'):
+            filtered = view._branchcaches._per_filter
+        else:
+            # older versions
+            filtered = view._branchcaches
         def d():
             if clear_revbranch:
                 repo.revbranchcache()._clear()
             if full:
                 view._branchcaches.clear()
             else:
-                view._branchcaches.pop(filtername, None)
+                filtered.pop(filtername, None)
             view.branchmap()
         return d
     # add filter in smaller subset to bigger subset