hgweb: avoid initialization race (issue4280) stable
authorMatt Mackall <mpm@selenic.com>
Mon, 16 Jun 2014 13:30:46 -0500
branchstable
changeset 21759 bd3360c63bb3
parent 21758 c27a37678508
child 21760 a7f5967ff644
hgweb: avoid initialization race (issue4280)
mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Mon Jun 16 12:04:48 2014 -0500
+++ b/mercurial/hgweb/hgweb_mod.py	Mon Jun 16 13:30:46 2014 -0500
@@ -109,8 +109,6 @@
         # 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
             r = hg.repository(self.repo.baseui, self.repo.root)
             self.repo = self._getview(r)
             self.maxchanges = int(self.config("web", "maxchanges", 10))
@@ -121,6 +119,9 @@
             self.allowpull = self.configbool("web", "allowpull", True)
             encoding.encoding = self.config("web", "encoding",
                                             encoding.encoding)
+            # update these last to avoid threads seeing empty settings
+            self.mtime = st.st_mtime
+            self.size = st.st_size
         if request:
             self.repo.ui.environ = request.env