comparison mercurial/hgweb/hgweb_mod.py @ 21759:bd3360c63bb3 stable

hgweb: avoid initialization race (issue4280)
author Matt Mackall <mpm@selenic.com>
date Mon, 16 Jun 2014 13:30:46 -0500
parents 49f2d5644f04
children af62f0280a76
comparison
equal deleted inserted replaced
21758:c27a37678508 21759:bd3360c63bb3
107 def refresh(self, request=None): 107 def refresh(self, request=None):
108 st = get_stat(self.repo.spath) 108 st = get_stat(self.repo.spath)
109 # compare changelog size in addition to mtime to catch 109 # compare changelog size in addition to mtime to catch
110 # rollbacks made less than a second ago 110 # rollbacks made less than a second ago
111 if st.st_mtime != self.mtime or st.st_size != self.size: 111 if st.st_mtime != self.mtime or st.st_size != self.size:
112 self.mtime = st.st_mtime
113 self.size = st.st_size
114 r = hg.repository(self.repo.baseui, self.repo.root) 112 r = hg.repository(self.repo.baseui, self.repo.root)
115 self.repo = self._getview(r) 113 self.repo = self._getview(r)
116 self.maxchanges = int(self.config("web", "maxchanges", 10)) 114 self.maxchanges = int(self.config("web", "maxchanges", 10))
117 self.stripecount = int(self.config("web", "stripes", 1)) 115 self.stripecount = int(self.config("web", "stripes", 1))
118 self.maxshortchanges = int(self.config("web", "maxshortchanges", 116 self.maxshortchanges = int(self.config("web", "maxshortchanges",
119 60)) 117 60))
120 self.maxfiles = int(self.config("web", "maxfiles", 10)) 118 self.maxfiles = int(self.config("web", "maxfiles", 10))
121 self.allowpull = self.configbool("web", "allowpull", True) 119 self.allowpull = self.configbool("web", "allowpull", True)
122 encoding.encoding = self.config("web", "encoding", 120 encoding.encoding = self.config("web", "encoding",
123 encoding.encoding) 121 encoding.encoding)
122 # update these last to avoid threads seeing empty settings
123 self.mtime = st.st_mtime
124 self.size = st.st_size
124 if request: 125 if request:
125 self.repo.ui.environ = request.env 126 self.repo.ui.environ = request.env
126 127
127 def run(self): 128 def run(self):
128 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."): 129 if not os.environ.get('GATEWAY_INTERFACE', '').startswith("CGI/1."):