Patchwork [2,of,2] hgweb: simplify calculation of first revision in filelog command

login
register
mail settings
Submitter Denis Laxalde
Date Jan. 17, 2017, 8:43 a.m.
Message ID <5853889926752381355a.1484642623@sh77.tls.logilab.fr>
Download mbox | patch
Permalink /patch/18235/
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 1484641164 -3600
#      Tue Jan 17 09:19:24 2017 +0100
# Node ID 5853889926752381355ab8b3c034339298305a14
# Parent  71e542e7d3df0ac9a48e1021bb5319405a307f87
hgweb: simplify calculation of first revision in filelog command
Pierre-Yves David - Jan. 17, 2017, 9:27 a.m.
On 01/17/2017 09:43 AM, Denis Laxalde wrote:
> # HG changeset patch
> # User Denis Laxalde <denis.laxalde@logilab.fr>
> # Date 1484641164 -3600
> #      Tue Jan 17 09:19:24 2017 +0100
> # Node ID 5853889926752381355ab8b3c034339298305a14
> # Parent  71e542e7d3df0ac9a48e1021bb5319405a307f87
> hgweb: simplify calculation of first revision in filelog command

These two are pushed, thanks.

Patch

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -972,7 +972,7 @@  def filelog(web, req, tmpl):
     morevars['revcount'] = revcount * 2
 
     count = fctx.filerev() + 1
-    start = max(0, fctx.filerev() - revcount + 1) # first rev on this page
+    start = max(0, count - revcount) # first rev on this page
     end = min(count, start + revcount) # last rev on this page
     parity = paritygen(web.stripecount, offset=start - end)