diff --git a/hgext3rd/perftweaks.py b/hgext3rd/perftweaks.py --- a/hgext3rd/perftweaks.py +++ b/hgext3rd/perftweaks.py @@ -52,6 +52,8 @@ wrapfunction(dispatch, 'runcommand', _tracksparseprofiles) wrapfunction(merge, 'update', _trackupdatesize) + wrapfunction(localrepo.localrepository, 'updatecaches', _updatecaches) + try: rebase = extensions.find('rebase') wrapfunction(rebase.rebaseruntime, '_preparenewrebase', @@ -79,6 +81,19 @@ if repo.local() is not None: _preloadrevs(repo) + class perftweaksrepo(repo.__class__): + @localrepo.unfilteredmethod + def updatecaches(self, tr=None): + # Disable "branchmap.updatecache(self.filtered('served'))" + # code path guarded by "if tr.changes['revs']". First, we + # don't have on-disk branchmap. Second, accessing + # "repo.filtered('served')" alone is not very cheap. + if tr and 'revs' in tr.changes: + del tr.changes['revs'] + super(clindexrepo, self).updatecaches(tr) + + repo.__class__ = perftweaksrepo + def _singlenode(orig, self, repo, name): """Skips reading branches namespace if unnecessary""" if repo.ui.configbool('tweakdefaults', 'allowbranch', True):