Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/hgweb_mod.py @ 13959:141f88ae5276
merge with stable
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Tue, 19 Apr 2011 15:19:54 +0200 |
parents | b51bf961b3cb 71f51cc71652 |
children | 616ad3f6fd33 |
comparison
equal
deleted
inserted
replaced
13956:ffb5c09ba822 | 13959:141f88ae5276 |
---|---|
6 # This software may be used and distributed according to the terms of the | 6 # This software may be used and distributed according to the terms of the |
7 # GNU General Public License version 2 or any later version. | 7 # GNU General Public License version 2 or any later version. |
8 | 8 |
9 import os | 9 import os |
10 from mercurial import ui, hg, hook, error, encoding, templater | 10 from mercurial import ui, hg, hook, error, encoding, templater |
11 from common import get_mtime, ErrorResponse, permhooks, caching | 11 from common import get_stat, ErrorResponse, permhooks, caching |
12 from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST | 12 from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST |
13 from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR | 13 from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR |
14 from request import wsgirequest | 14 from request import wsgirequest |
15 import webcommands, protocol, webutil | 15 import webcommands, protocol, webutil |
16 | 16 |
37 | 37 |
38 self.repo.ui.setconfig('ui', 'report_untrusted', 'off') | 38 self.repo.ui.setconfig('ui', 'report_untrusted', 'off') |
39 self.repo.ui.setconfig('ui', 'interactive', 'off') | 39 self.repo.ui.setconfig('ui', 'interactive', 'off') |
40 hook.redirect(True) | 40 hook.redirect(True) |
41 self.mtime = -1 | 41 self.mtime = -1 |
42 self.size = -1 | |
42 self.reponame = name | 43 self.reponame = name |
43 self.archives = 'zip', 'gz', 'bz2' | 44 self.archives = 'zip', 'gz', 'bz2' |
44 self.stripecount = 1 | 45 self.stripecount = 1 |
45 # a repo owner may set web.templates in .hg/hgrc to get any file | 46 # a repo owner may set web.templates in .hg/hgrc to get any file |
46 # readable by the user running the CGI script | 47 # readable by the user running the CGI script |
61 untrusted=untrusted) | 62 untrusted=untrusted) |
62 | 63 |
63 def refresh(self, request=None): | 64 def refresh(self, request=None): |
64 if request: | 65 if request: |
65 self.repo.ui.environ = request.env | 66 self.repo.ui.environ = request.env |
66 mtime = get_mtime(self.repo.spath) | 67 st = get_stat(self.repo.spath) |
67 if mtime != self.mtime: | 68 # compare changelog size in addition to mtime to catch |
68 self.mtime = mtime | 69 # rollbacks made less than a second ago |
70 if st.st_mtime != self.mtime or st.st_size != self.size: | |
71 self.mtime = st.st_mtime | |
72 self.size = st.st_size | |
69 self.repo = hg.repository(self.repo.ui, self.repo.root) | 73 self.repo = hg.repository(self.repo.ui, self.repo.root) |
70 self.maxchanges = int(self.config("web", "maxchanges", 10)) | 74 self.maxchanges = int(self.config("web", "maxchanges", 10)) |
71 self.stripecount = int(self.config("web", "stripes", 1)) | 75 self.stripecount = int(self.config("web", "stripes", 1)) |
72 self.maxshortchanges = int(self.config("web", "maxshortchanges", 60)) | 76 self.maxshortchanges = int(self.config("web", "maxshortchanges", 60)) |
73 self.maxfiles = int(self.config("web", "maxfiles", 10)) | 77 self.maxfiles = int(self.config("web", "maxfiles", 10)) |