changeset 40728:2cd5f1fac788

hgweb: load globally-enabled extensions explicitly Before, extensions were loaded as a side effect of hg.repository() if the hgweb was executed as a CGI/WSGI. I want to make it explicit so that another ui hook can be inserted after extensions.loadall().
author Yuya Nishihara <yuya@tcha.org>
date Sat, 17 Nov 2018 19:11:45 +0900
parents 0800d9e6e216
children c93d046d4300
files mercurial/hgweb/hgweb_mod.py mercurial/hgweb/hgwebdir_mod.py
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py	Sat Nov 24 14:11:02 2018 -0500
+++ b/mercurial/hgweb/hgweb_mod.py	Sat Nov 17 19:11:45 2018 +0900
@@ -22,6 +22,7 @@
 from .. import (
     encoding,
     error,
+    extensions,
     formatter,
     hg,
     hook,
@@ -212,6 +213,7 @@
                 u = baseui.copy()
             else:
                 u = uimod.ui.load()
+                extensions.loadall(u)
             r = hg.repository(u, repo)
         else:
             # we trust caller to give us a private copy
--- a/mercurial/hgweb/hgwebdir_mod.py	Sat Nov 24 14:11:02 2018 -0500
+++ b/mercurial/hgweb/hgwebdir_mod.py	Sat Nov 17 19:11:45 2018 +0900
@@ -30,6 +30,7 @@
     configitems,
     encoding,
     error,
+    extensions,
     hg,
     profiling,
     pycompat,
@@ -268,6 +269,9 @@
         self.lastrefresh = 0
         self.motd = None
         self.refresh()
+        if not baseui:
+            # set up environment for new ui
+            extensions.loadall(self.ui)
 
     def refresh(self):
         if self.ui: