From patchwork Wed Jan 16 13:32:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [13,of,15,V3] hgweb: use changelog for iteration From: Pierre-Yves David X-Patchwork-Id: 650 Message-Id: <6127540415952a1cdf10.1358343139@crater2.logilab.fr> To: mercurial-devel@selenic.com Cc: pierre-yves.david@logilab.fr Date: Wed, 16 Jan 2013 14:32:19 +0100 # HG changeset patch # User Pierre-Yves David # Date 1357862880 -3600 # Node ID 6127540415952a1cdf10a6292e04a01ca9c3e238 # Parent f048717d6e8a5fb3fae5b2241e373cc72de27533 hgweb: use changelog for iteration Iterating through changelog is necessary to enforce filtering. diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -194,14 +194,17 @@ def changelog(web, req, tmpl, shortlog=F except error.RepoError: return _search(web, req, tmpl) # XXX redirect to 404 page? def changelist(latestonly, **map): l = [] # build a list in forward order for efficiency + revs = [] + if start < end: + revs = web.repo.changelog.revs(start, end - 1) if latestonly: - revs = (end - 1,) - else: - revs = xrange(start, end) + for r in revs: + pass + revs = (r,) for i in revs: ctx = web.repo[i] n = ctx.node() showtags = webutil.showtag(web.repo, tmpl, 'changelogtag', n) files = webutil.listfilediffs(tmpl, ctx.files(), n, web.maxfiles) @@ -743,14 +746,15 @@ def filelog(web, req, tmpl): def entries(latestonly, **map): l = [] repo = web.repo + revs = repo.changelog.revs(start, end - 1) if latestonly: - revs = (end - 1,) - else: - revs = xrange(start, end) + for r in revs: + pass + revs = (r,) for i in revs: iterfctx = fctx.filectx(i) l.append({"parity": parity.next(), "filerev": i,