comparison mercurial/hgweb/common.py @ 22577:a111e460318a stable

hgweb: refresh hgweb.repo on phase change (issue4061) Make hgweb.refresh() also look at phaseroots file (in addition to 00changelog.i file) and reload the repo when os.stat returns different mtime or size than cached, signifying the file was modified. This way if user changes phase of a changeset (secret <-> draft), there's no need to restart hg serve to see the change.
author Anton Shestakov <engored@ya.ru>
date Sat, 27 Sep 2014 21:59:55 +0900
parents d51c4d85ec23
children 328739ea70c3
comparison
equal deleted inserted replaced
22576:c712238c4f9b 22577:a111e460318a
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): 115 def get_stat(spath, fn="00changelog.i"):
116 """stat changelog if it exists, spath otherwise""" 116 """stat fn (00changelog.i by default) if it exists, spath otherwise"""
117 cl_path = os.path.join(spath, "00changelog.i") 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