Patchwork [05,of,23,Series-D] hgweb: use changelog for iteration

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 11, 2013, 12:23 a.m.
Message ID <5e317515a6823d949486.1357863830@yamac.lan>
Download mbox | patch
Permalink /patch/548/
State Superseded
Headers show

Comments

Pierre-Yves David - Jan. 11, 2013, 12:23 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1357862880 -3600
# Node ID 5e317515a6823d949486a5367eed2ea248e55063
# Parent  850eaea6a6e3a137b1df2b59ae1c9714e8d5999f
hgweb: use changelog for iteration

Iterating through changelog is  necessary to enforce filtering.

Patch

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -194,13 +194,17 @@  def changelog(web, req, tmpl, shortlog=F
         except error.RepoError:
             return _search(web, req, tmpl) # XXX redirect to 404 page?
 
     def changelist(lastest=False, **map):
         l = [] # build a list in forward order for efficiency
-        revs = xrange(start, end)
+        revs = []
+        if start < end:
+            revs = web.repo.changelog.revs(start, end - 1)
         if lastest:
-            revs = (end - 1,)
+            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)
@@ -742,13 +746,15 @@  def filelog(web, req, tmpl):
 
     def entries(lastest=False, **map):
         l = []
 
         repo = web.repo
-        revs = xrange(start, end)
+        revs = repo.changelog.revs(start, end - 1)
         if lastest:
-            revs = (end - 1,)
+            for r in revs:
+                pass
+            revs = (r,)
         for i in revs:
             iterfctx = fctx.filectx(i)
 
             l.append({"parity": parity.next(),
                       "filerev": i,