[PATCH 4 of 4] hgweb: make hgweb filelog output consistent with command line one

Alexander Plavin alexander at plav.in
Sun Nov 10 08:25:24 CST 2013


# HG changeset patch
# User Alexander Plavin <alexander at plav.in>
# Date 1384093449 -14400
#      Sun Nov 10 18:24:09 2013 +0400
# Node ID b0f4c5d5f5fd0153f203e9bacf58aac84abc66f2
# Parent  3e5ee03883a959fdfc4b4e9b10437c5d3bdcc74a
hgweb: make hgweb filelog output consistent with command line one

Before this the hgweb filelog showed changesets with obsolescence markers.

diff -r 3e5ee03883a9 -r b0f4c5d5f5fd mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py	Sun Nov 10 18:23:29 2013 +0400
+++ b/mercurial/hgweb/webcommands.py	Sun Nov 10 18:24:09 2013 +0400
@@ -833,37 +833,39 @@
     morevars['revcount'] = revcount * 2
 
     count = fctx.filerev() + 1
-    start = max(0, fctx.filerev() - revcount + 1) # first rev on this page
-    end = min(count, start + revcount) # last rev on this page
-    parity = paritygen(web.stripecount, offset=start - end)
+    end = fctx.filerev() # last rev on this page
+    parity = paritygen(web.stripecount)
 
     def entries():
-        l = []
+        repo = web.repo
+        revs = fctx.filelog().revs(end, 0)
+        curcount = 0
 
-        repo = web.repo
-        revs = fctx.filelog().revs(start, end - 1)
         for i in revs:
             iterfctx = fctx.filectx(i)
+            if iterfctx.rev() not in repo:
+                continue
 
-            l.append({"parity": parity.next(),
-                      "filerev": i,
-                      "file": f,
-                      "node": iterfctx.hex(),
-                      "author": iterfctx.user(),
-                      "date": iterfctx.date(),
-                      "rename": webutil.renamelink(iterfctx),
-                      "parent": webutil.parents(iterfctx),
-                      "child": webutil.children(iterfctx),
-                      "desc": iterfctx.description(),
-                      "extra": iterfctx.extra(),
-                      "tags": webutil.nodetagsdict(repo, iterfctx.node()),
-                      "bookmarks": webutil.nodebookmarksdict(
-                          repo, iterfctx.node()),
-                      "branch": webutil.nodebranchnodefault(iterfctx),
-                      "inbranch": webutil.nodeinbranch(repo, iterfctx),
-                      "branches": webutil.nodebranchdict(repo, iterfctx)})
-        for e in reversed(l):
-            yield e
+            curcount += 1
+            if curcount > revcount:
+                break
+            yield {"parity": parity.next(),
+                   "filerev": i,
+                   "file": f,
+                   "node": iterfctx.hex(),
+                   "author": iterfctx.user(),
+                   "date": iterfctx.date(),
+                   "rename": webutil.renamelink(iterfctx),
+                   "parent": webutil.parents(iterfctx),
+                   "child": webutil.children(iterfctx),
+                   "desc": iterfctx.description(),
+                   "extra": iterfctx.extra(),
+                   "tags": webutil.nodetagsdict(repo, iterfctx.node()),
+                   "bookmarks": webutil.nodebookmarksdict(
+                       repo, iterfctx.node()),
+                   "branch": webutil.nodebranchnodefault(iterfctx),
+                   "inbranch": webutil.nodeinbranch(repo, iterfctx),
+                   "branches": webutil.nodebranchdict(repo, iterfctx)}
 
     entries = list(entries())
     latestentry = entries[:1]


More information about the Mercurial-devel mailing list