mercurial/context.py
changeset 31075 21f1f97ab212
parent 30824 6e1d54be7588
child 31076 0e07855e6054
--- 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