mercurial/ui.py
changeset 30832 da5fa0f13a41
parent 30814 b96c57c1f860
child 30835 bcad61a1f9a7
--- a/mercurial/ui.py	Tue Jan 17 13:44:53 2017 +0800
+++ b/mercurial/ui.py	Tue Jan 17 23:05:12 2017 -0500
@@ -147,6 +147,15 @@
 
             self.httppasswordmgrdb = urlreq.httppasswordmgrwithdefaultrealm()
 
+        allowed = self.configlist('experimental', 'exportableenviron')
+        if '*' in allowed:
+            self._exportableenviron = self.environ
+        else:
+            self._exportableenviron = {}
+            for k in allowed:
+                if k in self.environ:
+                    self._exportableenviron[k] = self.environ[k]
+
     @classmethod
     def load(cls):
         """Create a ui and load global and user configs"""
@@ -1211,6 +1220,12 @@
                 " update your code.)") % version
         self.develwarn(msg, stacklevel=2, config='deprec-warn')
 
+    def exportableenviron(self):
+        """The environment variables that are safe to export, e.g. through
+        hgweb.
+        """
+        return self._exportableenviron
+
     @contextlib.contextmanager
     def configoverride(self, overrides, source=""):
         """Context manager for temporary config overrides