D351: demandimport: disable if chg is being used
quark (Jun Wu)
phabricator at mercurial-scm.org
Fri Aug 18 17:58:29 UTC 2017
quark updated this revision to Diff 1076.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D351?vs=1011&id=1076
REVISION DETAIL
https://phab.mercurial-scm.org/D351
AFFECTED FILES
hg
mercurial/chgserver.py
CHANGE DETAILS
diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -565,8 +565,11 @@
self._hashstate, self._baseaddress)
def chgunixservice(ui, repo, opts):
- # CHGINTERNALMARK is temporarily set by chg client to detect if chg will
- # start another chg. drop it to avoid possible side effects.
+ # CHGINTERNALMARK is set by chg client. It is an indication of things are
+ # started by chg so other code can do things accordingly, like disabling
+ # demandimport or detecting chg client started by chg client. When executed
+ # here, CHGINTERNALMARK is no longer useful and hence dropped to make
+ # environ cleaner.
if 'CHGINTERNALMARK' in encoding.environ:
del encoding.environ['CHGINTERNALMARK']
diff --git a/hg b/hg
--- a/hg
+++ b/hg
@@ -28,15 +28,17 @@
# enable importing on demand to reduce startup time
try:
- if sys.version_info[0] < 3 or sys.version_info >= (3, 6):
+ # chg pre-imports modules so do not enable demandimport for it
+ if ('CHGINTERNALMARK' not in os.environ
+ and (sys.version_info[0] < 3 or sys.version_info >= (3, 6))):
import hgdemandimport; hgdemandimport.enable()
+ import mercurial.util
except ImportError:
sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" %
' '.join(sys.path))
sys.stderr.write("(check your install and PYTHONPATH)\n")
sys.exit(-1)
-import mercurial.util
import mercurial.dispatch
for fp in (sys.stdin, sys.stdout, sys.stderr):
To: quark, #hg-reviewers, phillco
Cc: phillco, sid0, yuja, mercurial-devel
More information about the Mercurial-devel
mailing list