comparison mercurial/dagop.py @ 35271:d90c534099b1

filectx: extract helper method to obtain filectx pointing to its introrev
author Yuya Nishihara <yuya@tcha.org>
date Sun, 22 Oct 2017 17:23:34 +0900
parents 0d27685b4a2f
children 70e86db6a913
comparison
equal deleted inserted replaced
35270:0d27685b4a2f 35271:d90c534099b1
266 def blockancestors(fctx, fromline, toline, followfirst=False): 266 def blockancestors(fctx, fromline, toline, followfirst=False):
267 """Yield ancestors of `fctx` with respect to the block of lines within 267 """Yield ancestors of `fctx` with respect to the block of lines within
268 `fromline`-`toline` range. 268 `fromline`-`toline` range.
269 """ 269 """
270 diffopts = patch.diffopts(fctx._repo.ui) 270 diffopts = patch.diffopts(fctx._repo.ui)
271 introrev = fctx.introrev() 271 fctx = fctx.introfilectx()
272 if fctx.rev() != introrev:
273 fctx = fctx.filectx(fctx.filenode(), changeid=introrev)
274 visit = {(fctx.linkrev(), fctx.filenode()): (fctx, (fromline, toline))} 272 visit = {(fctx.linkrev(), fctx.filenode()): (fctx, (fromline, toline))}
275 while visit: 273 while visit:
276 c, linerange2 = visit.pop(max(visit)) 274 c, linerange2 = visit.pop(max(visit))
277 pl = c.parents() 275 pl = c.parents()
278 if followfirst: 276 if followfirst: