# HG changeset patch # User Yuya Nishihara # Date 1474534126 -32400 # Node ID 70e86db6a913eee61f81ab0d6cf4a13110d94d3b # Parent d90c534099b17879b8b04118f97ac6e1602ea3f4 dagop: yield intro filectx by filectxancestors() This is the convention of dagop.*ancestors() functions. diff -r d90c534099b1 -r 70e86db6a913 mercurial/dagop.py --- a/mercurial/dagop.py Sun Oct 22 17:23:34 2017 +0900 +++ b/mercurial/dagop.py Thu Sep 22 17:48:46 2016 +0900 @@ -76,7 +76,7 @@ heapq.heappush(pendingheap, (heapsign * prev, pdepth)) def filectxancestors(fctx, followfirst=False): - """Like filectx.ancestors()""" + """Like filectx.ancestors(), but includes the given fctx itself""" visit = {} c = fctx if followfirst: @@ -84,6 +84,7 @@ else: cut = None + yield c while True: for parent in c.parents()[:cut]: visit[(parent.linkrev(), parent.filenode())] = parent diff -r d90c534099b1 -r 70e86db6a913 mercurial/revset.py --- a/mercurial/revset.py Sun Oct 22 17:23:34 2017 +0900 +++ b/mercurial/revset.py Thu Sep 22 17:48:46 2016 +0900 @@ -929,11 +929,9 @@ s = set() for fname in files: - fctx = c[fname] + fctx = c[fname].introfilectx() a = dagop.filectxancestors(fctx, followfirst) s = s.union(set(c.rev() for c in a)) - # include the revision responsible for the most recent version - s.add(fctx.introrev()) else: s = dagop.revancestors(repo, baseset([c.rev()]), followfirst)