[PATCH RFC] hgweb: replace some linkrev() with introrev() in hope issue4506 goes away

Anton Shestakov engored at ya.ru
Mon Feb 16 08:18:04 UTC 2015


# HG changeset patch
# User Anton Shestakov <engored at ya.ru>
# Date 1424074464 -28800
#      Mon Feb 16 16:14:24 2015 +0800
# Node ID 43dee1e7b5a6726697cc5cbdc20f77852ff10f0a
# Parent  0cfff4c42c9a146a09877cefee5a839cd70c6a2f
hgweb: replace some linkrev() with introrev() in hope issue4506 goes away

The issue is titled "filtered revision 'XXX' (not in 'served' subset)" and that
is the error message you sometimes get when trying to look at a file (/file or
/annotate) in hgweb. For example:

http://hg.intevation.org/mercurial/crew/file/90cf454edd70/mercurial/cmdutil.py

There's a test case in the issue, it involves rebase + evolve.

Looks like replacing ctx.linkrev() with ctx.introrev() fixes the problem (as
marmoute expected in one of the comments). There were no tests for something
like this, since they would probably require evolve extension. Which worries me
a bit, since on the other hand, this patch could break something that also
doesn't have tests. I'd like to tell more about the patch, but since I know
nothing about linkrev bugs, I'd rather listen.

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -139,8 +139,8 @@ def _siblings(siblings=[], hiderev=None)
 
 def parents(ctx, hide=None):
     if (isinstance(ctx, context.basefilectx) and
-        ctx.changectx().rev() != ctx.linkrev()):
-        return _siblings([ctx._repo[ctx.linkrev()]], hide)
+        ctx.changectx().rev() != ctx.introrev()):
+        return _siblings([ctx._repo[ctx.introrev()]], hide)
     return _siblings(ctx.parents(), hide)
 
 def children(ctx, hide=None):


More information about the Mercurial-devel mailing list