Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/common.py @ 13958:71f51cc71652 stable
hgweb: detect change based on changelog size too
Before, there was a race between an access and a modification made
within the same second.
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Tue, 19 Apr 2011 15:15:56 +0200 |
parents | 75f5f312df5f |
children | 141f88ae5276 |
comparison
equal
deleted
inserted
replaced
13957:044e1356327d | 13958:71f51cc71652 |
---|---|
84 return responses.get(code, ('Error', 'Unknown error'))[0] | 84 return responses.get(code, ('Error', 'Unknown error'))[0] |
85 | 85 |
86 def statusmessage(code, message=None): | 86 def statusmessage(code, message=None): |
87 return '%d %s' % (code, message or _statusmessage(code)) | 87 return '%d %s' % (code, message or _statusmessage(code)) |
88 | 88 |
89 def get_mtime(spath): | 89 def get_stat(spath): |
90 """stat changelog if it exists, spath otherwise""" | |
90 cl_path = os.path.join(spath, "00changelog.i") | 91 cl_path = os.path.join(spath, "00changelog.i") |
91 if os.path.exists(cl_path): | 92 if os.path.exists(cl_path): |
92 return os.stat(cl_path).st_mtime | 93 return os.stat(cl_path) |
93 else: | 94 else: |
94 return os.stat(spath).st_mtime | 95 return os.stat(spath) |
96 | |
97 def get_mtime(spath): | |
98 return get_stat(spath).st_mtime | |
95 | 99 |
96 def staticfile(directory, fname, req): | 100 def staticfile(directory, fname, req): |
97 """return a file inside directory with guessed Content-Type header | 101 """return a file inside directory with guessed Content-Type header |
98 | 102 |
99 fname always uses '/' as directory separator and isn't allowed to | 103 fname always uses '/' as directory separator and isn't allowed to |