mercurial/revset.py
changeset 15899 476a981fdf34
parent 15898 6902e13ddd03
child 15903 0329d3b12d8e
equal deleted inserted replaced
15898:6902e13ddd03 15899:476a981fdf34
   319                 if m(f):
   319                 if m(f):
   320                     s.append(r)
   320                     s.append(r)
   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):
   338     """``closed()``
   343     """``closed()``
   339     Changeset is closed.
   344     Changeset is closed.
   770 def roots(repo, subset, x):
   775 def roots(repo, subset, x):
   771     """``roots(set)``
   776     """``roots(set)``
   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):
   779     """``secret()``
   784     """``secret()``
   780     Changeset in secret phase."""
   785     Changeset in secret phase."""