# HG changeset patch # User mpm@selenic.com # Date 1117944147 28800 # Node ID 268bcb5a072a5130e6c7ceced070ec038adf00c9 # Parent 65dccc4555c28316077f7f6878312c3b81cd00d3 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----- diff -r 65dccc4555c2 -r 268bcb5a072a mercurial/hgweb.py --- 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")