##// END OF EJS Templates
revset: optimize roots and children
Matt Mackall -
r15899:476a981f default
parent child Browse files
Show More
@@ -321,17 +321,22 b' def checkstatus(repo, subset, pat, field'
321 break
321 break
322 return s
322 return s
323
323
324 def _children(repo, narrow, s):
325 cs = set()
326 pr = repo.changelog.parentrevs
327 s = set(s)
328 for r in narrow:
329 for p in pr(r):
330 if p in s:
331 cs.add(r)
332 return cs
333
324 def children(repo, subset, x):
334 def children(repo, subset, x):
325 """``children(set)``
335 """``children(set)``
326 Child changesets of changesets in set.
336 Child changesets of changesets in set.
327 """
337 """
328 cs = set()
338 s = getset(repo, range(len(repo)), x)
329 cl = repo.changelog
339 cs = _children(repo, subset, s)
330 s = set(getset(repo, range(len(repo)), x))
331 for r in xrange(0, len(repo)):
332 for p in cl.parentrevs(r):
333 if p in s:
334 cs.add(r)
335 return [r for r in subset if r in cs]
340 return [r for r in subset if r in cs]
336
341
337 def closed(repo, subset, x):
342 def closed(repo, subset, x):
@@ -772,7 +777,7 b' def roots(repo, subset, x):'
772 Changesets with no parent changeset in set.
777 Changesets with no parent changeset in set.
773 """
778 """
774 s = getset(repo, subset, x)
779 s = getset(repo, subset, x)
775 cs = set(children(repo, subset, x))
780 cs = _children(repo, s, s)
776 return [r for r in s if r not in cs]
781 return [r for r in s if r not in cs]
777
782
778 def secret(repo, subset, x):
783 def secret(repo, subset, x):
General Comments 0
You need to be logged in to leave comments. Login now