Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/common.py @ 10078:97c75ad3b1a0
hgweb: Make get_mtime use repository to find store path.
It was calculating it directly, which is redundant and caused
it to break with shared repositories.
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Tue, 15 Dec 2009 12:33:04 -0800 |
parents | 6f92997dbdca |
children | d6512b3e9ac0 |
comparison
equal
deleted
inserted
replaced
10077:89617aacb495 | 10078:97c75ad3b1a0 |
---|---|
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(repo_path): | 89 def get_mtime(spath): |
90 store_path = os.path.join(repo_path, ".hg") | 90 cl_path = os.path.join(spath, "00changelog.i") |
91 if not os.path.isdir(os.path.join(store_path, "data")): | |
92 store_path = os.path.join(store_path, "store") | |
93 cl_path = os.path.join(store_path, "00changelog.i") | |
94 if os.path.exists(cl_path): | 91 if os.path.exists(cl_path): |
95 return os.stat(cl_path).st_mtime | 92 return os.stat(cl_path).st_mtime |
96 else: | 93 else: |
97 return os.stat(store_path).st_mtime | 94 return os.stat(spath).st_mtime |
98 | 95 |
99 def staticfile(directory, fname, req): | 96 def staticfile(directory, fname, req): |
100 """return a file inside directory with guessed Content-Type header | 97 """return a file inside directory with guessed Content-Type header |
101 | 98 |
102 fname always uses '/' as directory separator and isn't allowed to | 99 fname always uses '/' as directory separator and isn't allowed to |