sapling/hgext/fastverify.py
Kostia Balytskyi e75b9fc1b1 fb-hgext: move most of hgext3rd and related tests to core
Summary:
This commit moves most of the stuff in hgext3rd and related tests to
hg-crew/hgext and hg-crew/test respectively.

The things that are not moved are the ones which require some more complex
imports.


Depends on D6675309

Test Plan: - tests are failing at this commit, fixes are in the following commits

Reviewers: #sourcecontrol

Differential Revision: https://phabricator.intern.facebook.com/D6675329
2018-01-09 03:03:59 -08:00

58 lines
1.6 KiB
Python

# fastverify.py
#
# Copyright 2017 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.
"""
disables parts of hg verify
Manifest verification can be extremely slow on large repos, so this extension
disables it if ``verify.skipmanifests`` is True.::
[verify]
skipmanifests = true
"""
from __future__ import absolute_import
from mercurial import (
extensions,
verify
)
from mercurial.i18n import _
testedwith = 'ships-with-fb-hgext'
class fastverifier(verify.verifier):
def __init__(self, *args, **kwargs):
super(fastverifier, self).__init__(*args, **kwargs)
def _verifymanifest(self, *args, **kwargs):
if self.ui.configbool("verify", "skipmanifests", True):
self.ui.warn(_("verify.skipmanifests is enabled; skipping "
"verification of manifests\n"))
return []
return super(fastverifier, self)._verifymanifest(*args, **kwargs)
def _crosscheckfiles(self, *args, **kwargs):
if self.ui.configbool("verify", "skipmanifests", True):
return
return super(fastverifier, self)._crosscheckfiles(*args, **kwargs)
def _verifyfiles(self, *args, **kwargs):
if self.ui.configbool("verify", "skipmanifests", True):
return 0, 0
return super(fastverifier, self)._verifyfiles(*args, **kwargs)
def extsetup(ui):
extensions.wrapfunction(verify, 'verify', _verify)
def _verify(orig, repo, *args, **kwds):
with repo.lock():
return fastverifier(repo, *args, **kwds).verify()