[PATCH] chgserver: more explicit about sensitive environ variables

Jun Wu quark at fb.com
Wed May 10 18:56:39 UTC 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1494442522 25200
#      Wed May 10 11:55:22 2017 -0700
# Node ID f275d21ea713de70a8cae521d3afc1fbe497de25
# Parent  1ada3d18e7fbc9069910f2c036992d2f2b28e058
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r f275d21ea713
chgserver: more explicit about sensitive environ variables

Environment variables like HGUSER, HGEDITOR, HGEDITFROM should not trigger
a new chgserver. This patch uses a whitelist for environ variables starting
with "HG" to reduce the number of servers.

I have went through `grep -o "[\"']HG[A-Z_0-9]*['\"]" -hR . | sort -u` so
the list should be up-to-date.

diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -76,5 +76,6 @@ def _hashlist(items):
 _envre = re.compile(r'''\A(?:
                     CHGHG
-                    |HG(?:[A-Z].*)?
+                    |HG(?:DEMANDIMPORT|EMITWARNINGS|MODULEPOLICY|PROF|RCPATH)?
+                    |HG(?:ENCODING|PLAIN).*
                     |LANG(?:UAGE)?
                     |LC_.*


More information about the Mercurial-devel mailing list