diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -96,6 +96,9 @@ def _enabledemandimport(): """enable importing on demand to reduce startup time""" + if 'CHGINTERNALMARK' in encoding.environ: + # do not enable demandimport for chgserver + return if sys.version_info[0] < 3 or sys.version_info >= (3, 6): demandimport.enable()