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

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.

Differential Revision: https://phab.mercurial-scm.org/D1177
This commit is contained in:
Jun Wu 2017-10-18 14:55:39 -07:00
parent 9906bb3d53
commit d0d741d8a7

View File

@ -108,8 +108,13 @@ def _confighash(ui):
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]