diff --git a/hgext3rd/perftweaks.py b/hgext3rd/perftweaks.py --- a/hgext3rd/perftweaks.py +++ b/hgext3rd/perftweaks.py @@ -36,6 +36,7 @@ wrapfunction(tags, '_readtagcache', _readtagcache) wrapfunction(merge, '_checkcollision', _checkcollision) wrapfunction(branchmap.branchcache, 'update', _branchmapupdate) + wrapfunction(branchmap, 'updatecache', _branchmapupdatecache) if ui.configbool('perftweaks', 'preferdeltas'): wrapfunction(revlog.revlog, '_isgooddelta', _isgooddelta) @@ -111,6 +112,16 @@ repo.ui.log('branchcache', 'perftweaks updated %s branch cache\n', repo.filtername) +def _branchmapupdatecache(orig, repo): + if not repo.ui.configbool('perftweaks', 'disablebranchcache'): + return orig(repo) + + filtername = repo.filtername + if filtername not in repo._branchcaches: + cache = branchmap.branchcache() + _branchmapupdate(None, cache, repo, None) + repo._branchcaches[filtername] = cache + def _branchmapwrite(orig, self, repo): result = orig(self, repo) if repo.ui.configbool('perftweaks', 'cachenoderevs', True):