Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/common.py @ 25717:46e2c57026bc
hgweb: drop the default argument for get_stat
This default argument is used twice and is making things confusing. Making it
explicit helps to clarify coming changesets
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 03 Jul 2015 10:07:51 -0700 |
parents | 328739ea70c3 |
children | 461e7b700fdf |
comparison
equal
deleted
inserted
replaced
25716:d50677c3bf44 | 25717:46e2c57026bc |
---|---|
110 return responses.get(code, ('Error', 'Unknown error'))[0] | 110 return responses.get(code, ('Error', 'Unknown error'))[0] |
111 | 111 |
112 def statusmessage(code, message=None): | 112 def statusmessage(code, message=None): |
113 return '%d %s' % (code, message or _statusmessage(code)) | 113 return '%d %s' % (code, message or _statusmessage(code)) |
114 | 114 |
115 def get_stat(spath, fn="00changelog.i"): | 115 def get_stat(spath, fn): |
116 """stat fn (00changelog.i by default) if it exists, spath otherwise""" | 116 """stat fn if it exists, spath otherwise""" |
117 cl_path = os.path.join(spath, fn) | 117 cl_path = os.path.join(spath, fn) |
118 if os.path.exists(cl_path): | 118 if os.path.exists(cl_path): |
119 return os.stat(cl_path) | 119 return os.stat(cl_path) |
120 else: | 120 else: |
121 return os.stat(spath) | 121 return os.stat(spath) |
122 | 122 |
123 def get_mtime(spath): | 123 def get_mtime(spath): |
124 return get_stat(spath).st_mtime | 124 return get_stat(spath, "00changelog.i").st_mtime |
125 | 125 |
126 def staticfile(directory, fname, req): | 126 def staticfile(directory, fname, req): |
127 """return a file inside directory with guessed Content-Type header | 127 """return a file inside directory with guessed Content-Type header |
128 | 128 |
129 fname always uses '/' as directory separator and isn't allowed to | 129 fname always uses '/' as directory separator and isn't allowed to |