diff -r dd5b5f99940d -r 2e8a88e5809f mercurial/branchmap.py --- a/mercurial/branchmap.py Fri Mar 08 16:49:06 2024 +0100 +++ b/mercurial/branchmap.py Sun Mar 10 04:53:17 2024 +0100 @@ -85,7 +85,8 @@ bcache._filtername, repo.filtername, ) - bcache.write(repo) + if bcache._dirty: + bcache.write(repo) def updatecache(self, repo): """Update the cache for the given filtered view on a repository"""