Patchwork [1,of,2] hgweb: restore ascending iteration on revs in filelog web command

login
register
mail settings
Submitter Denis Laxalde
Date Jan. 17, 2017, 8:43 a.m.
Message ID <71e542e7d3df0ac9a48e.1484642622@sh77.tls.logilab.fr>
Download mbox | patch
Permalink /patch/18234/
State Accepted
Headers show

Comments

Denis Laxalde - Jan. 17, 2017, 8:43 a.m.
# HG changeset patch
# User Denis Laxalde <denis.laxalde@logilab.fr>
# Date 1484641049 -3600
#      Tue Jan 17 09:17:29 2017 +0100
# Node ID 71e542e7d3df0ac9a48e1021bb5319405a307f87
# Parent  4c0a5a256ae806fab18d56b3c44a8d1c98a40ce0
hgweb: restore ascending iteration on revs in filelog web command

Follow-up on 96f811bceb85. Adjust back the "parity" generator's offset to keep
rendering the same.

Patch

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -974,12 +974,12 @@  def filelog(web, req, tmpl):
     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 + 1)
+    parity = paritygen(web.stripecount, offset=start - end)
 
     repo = web.repo
     revs = fctx.filelog().revs(start, end - 1)
     entries = []
-    for i in reversed(revs):
+    for i in revs:
         iterfctx = fctx.filectx(i)
         entries.append(dict(
             parity=next(parity),
@@ -987,6 +987,7 @@  def filelog(web, req, tmpl):
             file=f,
             rename=webutil.renamelink(iterfctx),
             **webutil.commonentry(repo, iterfctx)))
+    entries.reverse()
 
     latestentry = entries[:1]