##// END OF EJS Templates
dagop: extend filectxancestors() to walk multiple files
Yuya Nishihara -
r35277:205c3c6c default
parent child Browse files
Show More
@@ -75,8 +75,9 b' def _walkrevtree(pfunc, revs, startdepth'
75 75 if prev != node.nullrev:
76 76 heapq.heappush(pendingheap, (heapsign * prev, pdepth))
77 77
78 def filectxancestors(fctx, followfirst=False):
79 """Like filectx.ancestors(), but includes the given fctx itself"""
78 def filectxancestors(fctxs, followfirst=False):
79 """Like filectx.ancestors(), but can walk from multiple files/revisions,
80 and includes the given fctxs themselves"""
80 81 visit = {}
81 82 def addvisit(fctx):
82 83 rev = fctx.rev()
@@ -89,7 +90,8 b' def filectxancestors(fctx, followfirst=F'
89 90 else:
90 91 cut = None
91 92
92 addvisit(fctx)
93 for c in fctxs:
94 addvisit(c)
93 95 while visit:
94 96 rev = max(visit)
95 97 c = visit[rev].pop()
@@ -927,11 +927,9 b' def _follow(repo, subset, x, name, follo'
927 927
928 928 files = c.manifest().walk(matcher)
929 929
930 s = set()
931 for fname in files:
932 fctx = c[fname].introfilectx()
933 a = dagop.filectxancestors(fctx, followfirst)
934 s = s.union(set(c.rev() for c in a))
930 fctxs = [c[f].introfilectx() for f in files]
931 a = dagop.filectxancestors(fctxs, followfirst)
932 s = set(c.rev() for c in a)
935 933 else:
936 934 s = dagop.revancestors(repo, baseset([c.rev()]), followfirst)
937 935
General Comments 0
You need to be logged in to leave comments. Login now