# HG changeset patch # User Gregory Szorc # Date 2017-07-06 19:06:37 # Node ID 41448fc51510c7d56d2bd5de0a69add7444f0299 # Parent f41a99c45956187807cc355a48522cf30825ff56 sparse: variable to track if sparse is enabled Currently, the sparse extension sniffs repo instances for attributes defined by the sparse extension to determine if sparse is enabled. As we move code away from repo instances, these checks will be a bit more brittle. We introduce a module-level variable to track whether sparse is enabled as a temporary workaround. diff --git a/hgext/sparse.py b/hgext/sparse.py --- a/hgext/sparse.py +++ b/hgext/sparse.py @@ -110,6 +110,8 @@ def uisetup(ui): _setupcommit(ui) def extsetup(ui): + sparse.enabled = True + _setupclone(ui) _setuplog(ui) _setupadd(ui) diff --git a/mercurial/sparse.py b/mercurial/sparse.py --- a/mercurial/sparse.py +++ b/mercurial/sparse.py @@ -12,6 +12,11 @@ from . import ( error, ) +# Whether sparse features are enabled. This variable is intended to be +# temporary to facilitate porting sparse to core. It should eventually be +# a per-repo option, possibly a repo requirement. +enabled = False + def parseconfig(ui, raw): """Parse sparse config file content.