# perftweaks.py # # Copyright 2015 Facebook, Inc. # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. """extension for tweaking Mercurial features to improve performance.""" from mercurial import tags, merge from mercurial.extensions import wrapcommand, wrapfunction from mercurial.i18n import _ import os testedwith = 'internal' def extsetup(ui): wrapfunction(tags, '_readtagcache', _readtagcache) wrapfunction(merge, '_checkcollision', _checkcollision) def _readtagcache(orig, ui, repo): """Disables reading tags if the repo is known to not contain any.""" if ui.configbool('perftweaks', 'disabletags'): return (None, None, None, {}, False) return orig(ui, repo) def _checkcollision(orig, repo, wmf, actions): """Disables case collision checking since it is known to be very slow.""" if repo.ui.configbool('perftweaks', 'disablecasecheck'): return orig(repo, wmf, actions)