Patchwork [02,of,11] context: also return ancestor's line range in blockancestors

login
register
mail settings
Submitter Denis Laxalde
Date Feb. 22, 2017, 3:09 p.m.
Message ID <af5922c52aef6f494cb7.1487776196@sh77.tls.logilab.fr>
Download mbox | patch
Permalink /patch/18707/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Denis Laxalde - Feb. 22, 2017, 3:09 p.m.
# HG changeset patch
# User Denis Laxalde <denis.laxalde@logilab.fr>
# Date 1484583276 -3600
#      Mon Jan 16 17:14:36 2017 +0100
# Node ID af5922c52aef6f494cb7c7e9914f1ba987916ea2
# Parent  a65cc4f311cd1aab4502811e865a67ef7205c010
# EXP-Topic linerange-log/hgweb-filelog
context: also return ancestor's line range in blockancestors
Yuya Nishihara - Feb. 23, 2017, 2:49 p.m.
On Wed, 22 Feb 2017 16:09:56 +0100, Denis Laxalde wrote:
> # HG changeset patch
> # User Denis Laxalde <denis.laxalde@logilab.fr>
> # Date 1484583276 -3600
> #      Mon Jan 16 17:14:36 2017 +0100
> # Node ID af5922c52aef6f494cb7c7e9914f1ba987916ea2
> # Parent  a65cc4f311cd1aab4502811e865a67ef7205c010
> # EXP-Topic linerange-log/hgweb-filelog
> context: also return ancestor's line range in blockancestors

> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -1145,7 +1145,7 @@ def followlines(repo, subset, x):
>      fromline -= 1
>  
>      fctx = repo[rev].filectx(fname)
> -    revs = (c.rev() for c in context.blockancestors(fctx, fromline, toline))
> +    revs = (c.rev() for c, _ in context.blockancestors(fctx, fromline, toline))

It shadows the global _() function. Changed to 'for c, _linerange'.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1179,7 +1179,7 @@  def blockancestors(fctx, fromline, tolin
             pl = pl[:1]
         if not pl:
             # The block originates from the initial revision.
-            yield c
+            yield c, linerange2
             continue
         inrange = False
         for p in pl:
@@ -1192,7 +1192,7 @@  def blockancestors(fctx, fromline, tolin
                 continue
             visit[p.linkrev(), p.filenode()] = p, linerange1
         if inrange:
-            yield c
+            yield c, linerange2
 
 class committablectx(basectx):
     """A committablectx object provides common functionality for a context that
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1145,7 +1145,7 @@  def followlines(repo, subset, x):
     fromline -= 1
 
     fctx = repo[rev].filectx(fname)
-    revs = (c.rev() for c in context.blockancestors(fctx, fromline, toline))
+    revs = (c.rev() for c, _ in context.blockancestors(fctx, fromline, toline))
     return subset & generatorset(revs, iterasc=False)
 
 @predicate('all()', safe=True)