[PATCH 11 of 13 sparse] merge: variable to track if sparse is enabled

Gregory Szorc gregory.szorc at gmail.com
Sat Jul 1 21:55:28 EDT 2017


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1498945812 25200
#      Sat Jul 01 14:50:12 2017 -0700
# Node ID 7d0bacb3f8bb5f8b350acfeb79802b8486fd1337
# Parent  3d25c8086aa11be32b459d944098118a59fbc46d
merge: 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
@@ -109,6 +109,8 @@ def uisetup(ui):
     _setupcommit(ui)
 
 def extsetup(ui):
+    mergemod.sparseenabled = True
+
     _setupclone(ui)
     _setuplog(ui)
     _setupadd(ui)
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1748,6 +1748,8 @@ def graft(repo, ctx, pctx, labels, keepp
         copies.duplicatecopies(repo, ctx.rev(), pctx.rev())
     return stats
 
+sparseenabled = False
+
 def readsparseconfig(ui, raw):
     """Parse sparse config file content.
 


More information about the Mercurial-devel mailing list