diff mercurial/hgweb/hgweb_mod.py @ 18826:35fb2ef52a39

hgweb: do not pass on repo.ui when recreating a repo Recreate the repo with the global configuration in repo.baseui. The repo configuration is reread anyway. And now deleted repo configuration is reset to the default value.
author Simon Heimberg <simohe@besonet.ch>
date Thu, 21 Mar 2013 18:16:48 +0100
parents 013fcd112f13
children f02045645d12
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py	Wed Oct 10 21:55:49 2012 +0200
+++ b/mercurial/hgweb/hgweb_mod.py	Thu Mar 21 18:16:48 2013 +0100
@@ -65,7 +65,9 @@
 
         self.repo = self._getview(self.repo)
         self.repo.ui.setconfig('ui', 'report_untrusted', 'off')
+        self.repo.baseui.setconfig('ui', 'report_untrusted', 'off')
         self.repo.ui.setconfig('ui', 'nontty', 'true')
+        self.repo.baseui.setconfig('ui', 'nontty', 'true')
         hook.redirect(True)
         self.mtime = -1
         self.size = -1
@@ -101,16 +103,14 @@
             return repo.filtered('served')
 
     def refresh(self, request=None):
-        if request:
-            self.repo.ui.environ = request.env
         st = get_stat(self.repo.spath)
         # compare changelog size in addition to mtime to catch
         # rollbacks made less than a second ago
         if st.st_mtime != self.mtime or st.st_size != self.size:
             self.mtime = st.st_mtime
             self.size = st.st_size
-            self.repo = hg.repository(self.repo.ui, self.repo.root)
-            self.repo = self._getview(self.repo)
+            r = hg.repository(self.repo.baseui, self.repo.root)
+            self.repo = self._getview(r)
             self.maxchanges = int(self.config("web", "maxchanges", 10))
             self.stripecount = int(self.config("web", "stripes", 1))
             self.maxshortchanges = int(self.config("web", "maxshortchanges",
@@ -119,6 +119,8 @@
             self.allowpull = self.configbool("web", "allowpull", True)
             encoding.encoding = self.config("web", "encoding",
                                             encoding.encoding)
+        if request:
+            self.repo.ui.environ = request.env
 
     def run(self):
         if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):