Patchwork D1177: chgserver: do not treat HG as sensitive environ when CHGHG is set

login
register
mail settings
Submitter phabricator
Date Oct. 18, 2017, 9:57 p.m.
Message ID <differential-rev-PHID-DREV-5c4ltcierwchk3ppxckq-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/25212/
State Superseded
Headers show

Comments

phabricator - Oct. 18, 2017, 9:57 p.m.
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  When `$CHGHG` is set, `$HG` is ignored by the chg client. Removing it from
  chg's sensitive environment list would avoid starting up servers
  unnecessarily when `$CHGHG` is the same while `$HG` is different.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/chgserver.py

CHANGE DETAILS




To: quark, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -108,8 +108,13 @@ 
     for section, item in _configsectionitems:
         sectionitems.append(ui.config(section, item))
     sectionhash = _hashlist(sectionitems)
+    # If $CHGHG is set, the change to $HG should not trigger a new chg server
+    if 'CHGHG' in encoding.environ:
+        ignored = {'HG'}
+    else:
+        ignored = set()
     envitems = [(k, v) for k, v in encoding.environ.iteritems()
-                if _envre.match(k)]
+                if _envre.match(k) and k not in ignored]
     envhash = _hashlist(sorted(envitems))
     return sectionhash[:6] + envhash[:6]