changeset 21759:bd3360c63bb3 stable

hgweb: avoid initialization race (issue4280)
author Matt Mackall <mpm@selenic.com>
date Mon, 16 Jun 2014 13:30:46 -0500
parents c27a37678508
children a7f5967ff644
files mercurial/hgweb/hgweb_mod.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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