--- a/mercurial/hgweb/hgweb_mod.py Tue Apr 19 13:25:19 2011 +0200
+++ b/mercurial/hgweb/hgweb_mod.py Tue Apr 19 15:15:56 2011 +0200
@@ -8,7 +8,7 @@
import os
from mercurial import ui, hg, hook, error, encoding, templater
-from common import get_mtime, ErrorResponse, permhooks, caching
+from common import get_stat, ErrorResponse, permhooks, caching
from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST
from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR
from request import wsgirequest
@@ -38,6 +38,7 @@
self.repo.ui.setconfig('ui', 'interactive', 'off')
hook.redirect(True)
self.mtime = -1
+ self.size = -1
self.reponame = name
self.archives = 'zip', 'gz', 'bz2'
self.stripecount = 1
@@ -62,9 +63,12 @@
def refresh(self, request=None):
if request:
self.repo.ui.environ = request.env
- mtime = get_mtime(self.repo.spath)
- if mtime != self.mtime:
- self.mtime = mtime
+ st = get_stat(self.repo.spath)
+ # 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
self.repo = hg.repository(self.repo.ui, self.repo.root)
self.maxchanges = int(self.config("web", "maxchanges", 10))
self.stripecount = int(self.config("web", "stripes", 1))