Mercurial > hg
changeset 7311:de9c87fe1620
hgweb: move another utility function into the webutil module
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Mon, 03 Nov 2008 20:31:53 +0100 |
parents | bd522d09d5e3 |
children | 82f80c16fc16 |
files | mercurial/hgweb/hgweb_mod.py mercurial/hgweb/webcommands.py mercurial/hgweb/webutil.py |
diffstat | 3 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Mon Nov 03 20:41:48 2008 +0100 +++ b/mercurial/hgweb/hgweb_mod.py Mon Nov 03 20:31:53 2008 +0100 @@ -270,12 +270,6 @@ if i in allowed or self.configbool("web", "allow" + i): yield {"type" : i, "extension" : spec[2], "node" : nodeid} - def listfilediffs(self, tmpl, files, changeset): - for f in files[:self.maxfiles]: - yield tmpl("filedifflink", node=hex(changeset), file=f) - if len(files) > self.maxfiles: - yield tmpl("fileellipses") - archive_specs = { 'bz2': ('application/x-tar', 'tbz2', '.tar.bz2', None), 'gz': ('application/x-tar', 'tgz', '.tar.gz', None),
--- a/mercurial/hgweb/webcommands.py Mon Nov 03 20:41:48 2008 +0100 +++ b/mercurial/hgweb/webcommands.py Mon Nov 03 20:31:53 2008 +0100 @@ -130,6 +130,7 @@ count += 1 n = ctx.node() showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n) + files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles) yield tmpl('searchentry', parity=parity.next(), @@ -139,7 +140,7 @@ changelogtag=showtags, desc=ctx.description(), date=ctx.date(), - files=web.listfilediffs(tmpl, ctx.files(), n), + files=files, rev=ctx.rev(), node=hex(n), tags=webutil.nodetagsdict(web.repo, n), @@ -178,6 +179,7 @@ ctx = web.repo[i] n = ctx.node() showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n) + files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles) l.insert(0, {"parity": parity.next(), "author": ctx.user(), @@ -186,7 +188,7 @@ "changelogtag": showtags, "desc": ctx.description(), "date": ctx.date(), - "files": web.listfilediffs(tmpl, ctx.files(), n), + "files": files, "rev": i, "node": hex(n), "tags": webutil.nodetagsdict(web.repo, n),
--- a/mercurial/hgweb/webutil.py Mon Nov 03 20:41:48 2008 +0100 +++ b/mercurial/hgweb/webutil.py Mon Nov 03 20:31:53 2008 +0100 @@ -143,6 +143,12 @@ return fctx +def listfilediffs(tmpl, files, node, max): + for f in files[:max]: + yield tmpl('filedifflink', node=hex(node), file=f) + if len(files) > max: + yield tmpl('fileellipses') + def diffs(repo, tmpl, ctx, files, parity): def countgen():