mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
context: add a followfirst flag to blockancestors
This commit is contained in:
parent
22dbb9466c
commit
d3bcba7d25
@ -1166,7 +1166,7 @@ def _changesrange(fctx1, fctx2, linerange2, diffopts):
|
||||
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 @@ def blockancestors(fctx, fromline, toline):
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user