mercurial/revset.py
branchstable
changeset 17952 54cedee86e51
parent 17886 d8905e2c1301
child 17953 49c85541617b
child 17961 b0affcb67cba
equal deleted inserted replaced
17951:6f79c32c0bdf 17952:54cedee86e51
   569 def _descendants(repo, subset, x, followfirst=False):
   569 def _descendants(repo, subset, x, followfirst=False):
   570     args = getset(repo, list(repo), x)
   570     args = getset(repo, list(repo), x)
   571     if not args:
   571     if not args:
   572         return []
   572         return []
   573     s = set(_revdescendants(repo, args, followfirst)) | set(args)
   573     s = set(_revdescendants(repo, args, followfirst)) | set(args)
       
   574 
       
   575     if len(subset) == len(repo):
       
   576         # the passed in revisions may not exist, -1 for example
       
   577         for arg in args:
       
   578             if arg not in subset:
       
   579                 s.remove(arg)
       
   580         return list(s)
       
   581 
   574     return [r for r in subset if r in s]
   582     return [r for r in subset if r in s]
   575 
   583 
   576 def descendants(repo, subset, x):
   584 def descendants(repo, subset, x):
   577     """``descendants(set)``
   585     """``descendants(set)``
   578     Changesets which are descendants of changesets in set.
   586     Changesets which are descendants of changesets in set.
  1326 def roots(repo, subset, x):
  1334 def roots(repo, subset, x):
  1327     """``roots(set)``
  1335     """``roots(set)``
  1328     Changesets in set with no parent changeset in set.
  1336     Changesets in set with no parent changeset in set.
  1329     """
  1337     """
  1330     s = set(getset(repo, repo.changelog, x))
  1338     s = set(getset(repo, repo.changelog, x))
  1331     subset = [r for r in subset if r in s]
  1339     if len(subset) == len(repo):
       
  1340         subset = s
       
  1341     else:
       
  1342         subset = [r for r in subset if r in s]
  1332     cs = _children(repo, subset, s)
  1343     cs = _children(repo, subset, s)
  1333     return [r for r in subset if r not in cs]
  1344     return [r for r in subset if r not in cs]
  1334 
  1345 
  1335 def secret(repo, subset, x):
  1346 def secret(repo, subset, x):
  1336     """``secret()``
  1347     """``secret()``