Patchwork D351: demandimport: disable if chg is being used

login
register
mail settings
Submitter phabricator
Date Aug. 19, 2017, 6:57 a.m.
Message ID <032b177c6c1390b4b3785141fc26af6c@localhost.localdomain>
Download mbox | patch
Permalink /patch/23131/
State Not Applicable
Headers show

Comments

phabricator - Aug. 19, 2017, 6:57 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG3cfc9070245f: demandimport: disable if chg is being used (authored by quark).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D351?vs=1078&id=1087

REVISION DETAIL
  https://phab.mercurial-scm.org/D351

AFFECTED FILES
  hgdemandimport/__init__.py
  mercurial/chgserver.py

CHANGE DETAILS




To: quark, #hg-reviewers, phillco, yuja
Cc: phillco, sid0, yuja, mercurial-devel

Patch

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/hgdemandimport/__init__.py b/hgdemandimport/__init__.py
--- a/hgdemandimport/__init__.py
+++ b/hgdemandimport/__init__.py
@@ -73,5 +73,7 @@ 
 deactivated = demandimport.deactivated
 
 def enable():
-    if os.environ.get('HGDEMANDIMPORT') != 'disable':
+    # chg pre-imports modules so do not enable demandimport for it
+    if ('CHGINTERNALMARK' not in os.environ
+        and os.environ.get('HGDEMANDIMPORT') != 'disable'):
         demandimport.enable()