--- a/mercurial/context.py Mon Feb 20 18:40:42 2017 +0530
+++ b/mercurial/context.py Mon Jan 16 17:08:25 2017 +0100
@@ -1166,7 +1166,7 @@
diffinrange = any(stype == '!' for _, stype in filteredblocks)
return diffinrange, linerange1
-def blockancestors(fctx, fromline, toline):
+def blockancestors(fctx, fromline, toline, followfirst=False):
"""Yield ancestors of `fctx` with respect to the block of lines within
`fromline`-`toline` range.
"""
@@ -1175,6 +1175,8 @@
while visit:
c, linerange2 = visit.pop(max(visit))
pl = c.parents()
+ if followfirst:
+ pl = pl[:1]
if not pl:
# The block originates from the initial revision.
yield c