changeset 33299:41448fc51510

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.
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 06 Jul 2017 12:06:37 -0700
parents f41a99c45956
children f7a106b3f089
files hgext/sparse.py mercurial/sparse.py
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/sparse.py	Thu Jul 06 12:14:12 2017 -0700
+++ b/hgext/sparse.py	Thu Jul 06 12:06:37 2017 -0700
@@ -110,6 +110,8 @@
     _setupcommit(ui)
 
 def extsetup(ui):
+    sparse.enabled = True
+
     _setupclone(ui)
     _setuplog(ui)
     _setupadd(ui)
--- a/mercurial/sparse.py	Thu Jul 06 12:14:12 2017 -0700
+++ b/mercurial/sparse.py	Thu Jul 06 12:06:37 2017 -0700
@@ -12,6 +12,11 @@
     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.