Mercurial > public > mercurial-scm > hg-stable
diff mercurial/branchmap.py @ 51514:7f7086a42b2b
branchcache: have an explicit method to update the on disk cache
Explicit is better and will give use more flexibility for future evolution of
the storage.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 19 Jan 2024 11:30:10 +0100 |
parents | 02e7d79edf62 |
children | 3aba79ce52a9 |
line wrap: on
line diff
--- a/mercurial/branchmap.py Mon Feb 26 12:59:57 2024 +0100 +++ b/mercurial/branchmap.py Fri Jan 19 11:30:10 2024 +0100 @@ -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"""