changeset 8290:9ddb4bd52391

hg: set HGPLAIN globally to minimize potential impact from reading hgrc configuration when creating ui See `hg help scripting` for HGPLAIN description ... but Kallithea will invoke Mercurial internals directly, so HGPLAIN shouldn't really impact anything.
author Mads Kiilerich <mads@kiilerich.com>
date Fri, 06 Mar 2020 18:02:12 +0100
parents b10adac1ab7c
children 802fdeefc8cc
files kallithea/lib/utils.py kallithea/lib/vcs/utils/hgcompat.py
diffstat 2 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/utils.py	Fri Mar 06 16:58:47 2020 +0100
+++ b/kallithea/lib/utils.py	Fri Mar 06 18:02:12 2020 +0100
@@ -371,6 +371,7 @@
         else:
             log.debug('hgrc file is not present at %s, skipping...', hgrc_path)
 
+    assert baseui.plain()  # set by hgcompat.monkey_do (invoked from import of vcs.backends.hg) to minimize potential impact of loading config files
     return baseui
 
 
--- a/kallithea/lib/vcs/utils/hgcompat.py	Fri Mar 06 16:58:47 2020 +0100
+++ b/kallithea/lib/vcs/utils/hgcompat.py	Fri Mar 06 18:02:12 2020 +0100
@@ -2,6 +2,7 @@
 Mercurial libs compatibility
 """
 
+import mercurial.encoding
 import mercurial.localrepo
 
 
@@ -11,3 +12,6 @@
     mercurial.localrepo.localrepository._lfstatuswriters = [lambda *msg, **opts: None]
     # 3.5 7699d3212994 added the invariant that repo.lfstatus must exist before hitting overridearchive
     mercurial.localrepo.localrepository.lfstatus = False
+
+    # Minimize potential impact from custom configuration
+    mercurial.encoding.environ[b'HGPLAIN'] = b'1'