sparse: add back sparse.py

Summary:
Some consumers still rely on enabling 'sparse=' so let's add a module
that just redirects to the real fbsparse.py.

Also updates configerator to use the newer name.

Reviewed By: markbt, quark-zju

Differential Revision: D6755971

fbshipit-source-id: 3a67f029045dacf927742a616a714fe632b97fea
This commit is contained in:
Durham Goode 2018-01-23 12:08:29 -08:00 committed by Saurabh Singh
parent 97dfe79221
commit a99b9eb0c2
2 changed files with 35 additions and 0 deletions

34
hgext/sparse.py Normal file
View File

@ -0,0 +1,34 @@
# sparse.py - shim that redirects to load fbsparse
#
# Copyright 2014 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.
"""allow sparse checkouts of the working directory
"""
from __future__ import absolute_import
from hgext import fbsparse
cmdtable = fbsparse.cmdtable.copy()
def _fbsparseexists(ui):
with ui.configoverride({("devel", "all-warnings"): False}):
return not ui.config('extensions', 'fbsparse', '!').startswith('!')
def uisetup(ui):
if _fbsparseexists(ui):
cmdtable.clear()
return
fbsparse.uisetup(ui)
def extsetup(ui):
if _fbsparseexists(ui):
cmdtable.clear()
return
fbsparse.extsetup(ui)
def reposetup(ui, repo):
if _fbsparseexists(ui):
return
fbsparse.reposetup(ui, repo)

View File

@ -45,6 +45,7 @@ New errors are not allowed. Warnings are strongly discouraged.
$ testrepohg files "set:(**.py or **.txt) - tests/**" | sed 's|\\|/|g' |
> $PYTHON contrib/check-config.py
undocumented: extensions.fbsparse (str) ['!']
undocumented: extensions.treemanifest (str)
undocumented: fastlog.debug (str)
undocumented: fastlog.enabled (bool)