changeset 20168:d4be314b2071 stable

hgweb: avoid initialization race (issue3953)
author Matt Mackall <mpm@selenic.com>
date Wed, 04 Dec 2013 13:42:28 -0600
parents 09e41ac6289d
children 507919a34c5b 61a47fd64f30 c3623586378d
files mercurial/hgweb/hgweb_mod.py
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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: