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

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Jan 10 18:23:50 CST 2013


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1357862880 -3600
# Node ID 5e317515a6823d949486a5367eed2ea248e55063
# Parent  850eaea6a6e3a137b1df2b59ae1c9714e8d5999f
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,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,


More information about the Mercurial-devel mailing list