199 else: |
199 else: |
200 return repo.filtered('served') |
200 return repo.filtered('served') |
201 |
201 |
202 def refresh(self): |
202 def refresh(self): |
203 repostate = [] |
203 repostate = [] |
|
204 mtime = 0 |
204 # file of interrests mtime and size |
205 # file of interrests mtime and size |
205 for meth, fname in foi: |
206 for meth, fname in foi: |
206 prefix = getattr(self.repo, meth) |
207 prefix = getattr(self.repo, meth) |
207 st = get_stat(prefix, fname) |
208 st = get_stat(prefix, fname) |
208 repostate.append((st.st_mtime, st.st_size)) |
209 repostate.append((st.st_mtime, st.st_size)) |
|
210 mtime = max(mtime, st.st_mtime) |
209 repostate = tuple(repostate) |
211 repostate = tuple(repostate) |
210 # we need to compare file size in addition to mtime to catch |
212 # we need to compare file size in addition to mtime to catch |
211 # changes made less than a second ago |
213 # changes made less than a second ago |
212 if repostate != self.repostate: |
214 if repostate != self.repostate: |
213 r = hg.repository(self.repo.baseui, self.repo.url()) |
215 r = hg.repository(self.repo.baseui, self.repo.url()) |
214 self.repo = self._getview(r) |
216 self.repo = self._getview(r) |
215 # update these last to avoid threads seeing empty settings |
217 # update these last to avoid threads seeing empty settings |
216 self.repostate = repostate |
218 self.repostate = repostate |
217 # mtime is needed for ETag |
219 # mtime is needed for ETag |
218 self.mtime = st.st_mtime |
220 self.mtime = mtime |
219 |
221 |
220 def run(self): |
222 def run(self): |
221 """Start a server from CGI environment. |
223 """Start a server from CGI environment. |
222 |
224 |
223 Modern servers should be using WSGI and should avoid this |
225 Modern servers should be using WSGI and should avoid this |