Patchwork [STABLE] hgweb: fix duplication for some search queries

login
register
mail settings
Submitter Alexander Plavin
Date July 20, 2013, 9:56 p.m.
Message ID <d755725199c9fba008b9.1374357382@debian-alexander.dolgopa>
Download mbox | patch
Permalink /patch/1939/
State Accepted
Commit e111d5e6bbbd7f77e72d158929a41af7353f48cf
Headers show

Comments

Alexander Plavin - July 20, 2013, 9:56 p.m.
# HG changeset patch
# User Alexander Plavin <me@aplavin.ru>
# Date 1374356284 -14400
#      Sun Jul 21 01:38:04 2013 +0400
# Branch stable
# Node ID d755725199c9fba008b9a3b2c321da07d75f352d
# Parent  3289080e57cdc0f327f0ff2a8ecf25972941d31b
hgweb: fix duplication for some search queries

Given that N is maximum revision number in a repo, than if a revision with
number N-100n or N-100n+1 (for any integer n) is found with a hgweb search,
this revision is duplicated in search results.
Matt Mackall - July 25, 2013, 5:52 a.m.
On Sun, 2013-07-21 at 01:56 +0400, Alexander Plavin wrote:
> # HG changeset patch
> # User Alexander Plavin <me@aplavin.ru>
> # Date 1374356284 -14400
> #      Sun Jul 21 01:38:04 2013 +0400
> # Branch stable
> # Node ID d755725199c9fba008b9a3b2c321da07d75f352d
> # Parent  3289080e57cdc0f327f0ff2a8ecf25972941d31b
> hgweb: fix duplication for some search queries

Queued for stable, thanks.

Patch

diff -r 3289080e57cd -r d755725199c9 mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py	Fri Jul 19 00:20:53 2013 -0500
+++ b/mercurial/hgweb/webcommands.py	Sun Jul 21 01:38:04 2013 +0400
@@ -119,7 +119,7 @@ 
             cl = web.repo.changelog
             for i in xrange(len(web.repo) - 1, 0, -100):
                 l = []
-                for j in cl.revs(max(0, i - 100), i + 1):
+                for j in cl.revs(max(0, i - 99), i):
                     ctx = web.repo[j]
                     l.append(ctx)
                 l.reverse()