Mercurial > hg
changeset 258:268bcb5a072a
hgweb: watch changelog for changes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
hgweb: watch changelog for changes
Check the mtime of the changelog for updates on each invocation of
run(). For the standalone server, this means you don't need to re-run
it to pick up changes.
manifest hash: 398bdbf03b867df27da9e803a094dd265f62e12c
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFConlTywK+sNU5EO8RAljMAKCigJKR2aXabt1kuYeiAl+PZEN1owCeKShZ
oZKfo+I7e967FqI9l7NIPFE=
=pTp6
-----END PGP SIGNATURE-----
author | mpm@selenic.com |
---|---|
date | Sat, 04 Jun 2005 20:02:27 -0800 |
parents | 65dccc4555c2 |
children | 45c293b71341 |
files | mercurial/hgweb.py |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb.py Sat Jun 04 19:35:08 2005 -0800 +++ b/mercurial/hgweb.py Sat Jun 04 20:02:27 2005 -0800 @@ -119,7 +119,8 @@ def __init__(self, path, name, templates = ""): self.templates = templates or templatepath() self.reponame = name - self.repo = repository(ui(), path) + self.path = path + self.mtime = -1 self.viewonly = 0 self.filters = { @@ -131,6 +132,11 @@ "firstline": (lambda x: x.splitlines(1)[0]), } + def refresh(self): + s = os.stat(os.path.join(self.path, ".hg", "00changelog.i")) + if s.st_mtime != self.mtime: + self.repo = repository(ui(), self.path) + def date(self, cs): return time.asctime(time.gmtime(float(cs[2].split(' ')[0]))) @@ -566,6 +572,7 @@ # find tag, changeset, file def run(self): + self.refresh() args = cgi.parse() m = os.path.join(self.templates, "map")