diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
index d2858d97af6c6e929948b9d1a995071f495589a1_bWVyY3VyaWFsL2JyYW5jaG1hcC5weQ==..7f7086a42b2b215ca7c2029500b5d3b405fa1681_bWVyY3VyaWFsL2JyYW5jaG1hcC5weQ== 100644
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -59,7 +59,24 @@
 
     def __getitem__(self, repo):
         self.updatecache(repo)
-        return self._per_filter[repo.filtername]
+        bcache = self._per_filter[repo.filtername]
+        return bcache
+
+    def update_disk(self, repo):
+        """ensure and up-to-date cache is (or will be) written on disk
+
+        The cache for this repository view is updated  if needed and written on
+        disk.
+
+        If a transaction is in progress, the writing is schedule to transaction
+        close. See the `BranchMapCache.write_delayed` method.
+
+        This method exist independently of __getitem__ as it is sometime useful
+        to signal that we have no intend to use the data in memory yet.
+        """
+        self.updatecache(repo)
+        bcache = self._per_filter[repo.filtername]
+        bcache.write(repo)
 
     def updatecache(self, repo):
         """Update the cache for the given filtered view on a repository"""
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
index d2858d97af6c6e929948b9d1a995071f495589a1_bWVyY3VyaWFsL2xvY2FscmVwby5weQ==..7f7086a42b2b215ca7c2029500b5d3b405fa1681_bWVyY3VyaWFsL2xvY2FscmVwby5weQ== 100644
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2973,7 +2973,7 @@
             # they're a subset of another kind of cache that *has* been used).
             for filt in repoview.filtertable.keys():
                 filtered = self.filtered(filt)
-                filtered.branchmap().write(filtered)
+                self._branchcaches.update_disk(filtered)
 
     def invalidatecaches(self):
         if '_tagscache' in vars(self):