hgweb: avoid initialization race (issue3953) stable
authorMatt Mackall <mpm@selenic.com>
Wed, 04 Dec 2013 13:42:28 -0600
branchstable
changeset 20168 d4be314b2071
parent 20167 09e41ac6289d
child 20169 507919a34c5b
child 20208 61a47fd64f30
child 20210 c3623586378d
hgweb: avoid initialization race (issue3953)
mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Wed Dec 11 18:33:42 2013 -0600
+++ b/mercurial/hgweb/hgweb_mod.py	Wed Dec 04 13:42:28 2013 -0600
@@ -59,15 +59,16 @@
                 u = baseui.copy()
             else:
                 u = ui.ui()
-            self.repo = hg.repository(u, repo)
+            r = hg.repository(u, repo)
         else:
-            self.repo = repo
+            r = repo
 
-        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')
+        r = self._getview(r)
+        r.ui.setconfig('ui', 'report_untrusted', 'off')
+        r.baseui.setconfig('ui', 'report_untrusted', 'off')
+        r.ui.setconfig('ui', 'nontty', 'true')
+        r.baseui.setconfig('ui', 'nontty', 'true')
+        self.repo = r
         hook.redirect(True)
         self.mtime = -1
         self.size = -1
@@ -94,7 +95,8 @@
                                        untrusted=untrusted)
 
     def _getview(self, repo):
-        viewconfig = self.config('web', 'view', 'served')
+        viewconfig = repo.ui.config('web', 'view', 'served',
+                                    untrusted=True)
         if viewconfig == 'all':
             return repo.unfiltered()
         elif viewconfig in repoview.filtertable: