Patchwork [in,stable] hgweb: use latest mtime for caching tag (issue4814)

login
register
mail settings
Submitter Matt Mackall
Date Sept. 3, 2015, 5:20 p.m.
Message ID <ee31ede3afb8347d1e9f.1441300837@ruin.waste.org>
Download mbox | patch
Permalink /patch/10382/
State Accepted
Commit ee31ede3afb8347d1e9fad18fb7435d031955415
Headers show

Comments

Matt Mackall - Sept. 3, 2015, 5:20 p.m.
# HG changeset patch
# User Matt Mackall <mpm@selenic.com>
# Date 1441300783 18000
#      Thu Sep 03 12:19:43 2015 -0500
# Branch stable
# Node ID ee31ede3afb8347d1e9fad18fb7435d031955415
# Parent  d0843f7e16b4ef0199613934619b2f3a1154aeba
hgweb: use latest mtime for caching tag (issue4814)

Previously, we were using the last mtime we saw when reporting the
HTTP cache etag. When we added bookmarks to the end of the list of
files checked, unchanged or missing bookmarks would keep the client
cache from being invalidated.

Patch

diff -r d0843f7e16b4 -r ee31ede3afb8 mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Tue Sep 01 16:38:33 2015 -0500
+++ b/mercurial/hgweb/hgweb_mod.py	Thu Sep 03 12:19:43 2015 -0500
@@ -131,11 +131,13 @@ 
 
     def refresh(self, request=None):
         repostate = []
+        mtime = 0
         # file of interrests mtime and size
         for meth, fname in foi:
             prefix = getattr(self.repo, meth)
             st = get_stat(prefix, fname)
             repostate.append((st.st_mtime, st.st_size))
+            mtime = max(mtime, st.st_mtime)
         repostate = tuple(repostate)
         # we need to compare file size in addition to mtime to catch
         # changes made less than a second ago
@@ -153,7 +155,7 @@ 
             # update these last to avoid threads seeing empty settings
             self.repostate = repostate
             # mtime is needed for ETag
-            self.mtime = st.st_mtime
+            self.mtime = mtime
         if request:
             self.repo.ui.environ = request.env