comparison mercurial/revset.py @ 17980:83aa4359c49f

merge with stable
author Matt Mackall <mpm@selenic.com>
date Wed, 28 Nov 2012 16:15:05 -0600
parents 49c85541617b b0affcb67cba
children 34a1a639d835
comparison
equal deleted inserted replaced
17978:55b367bff8d2 17980:83aa4359c49f
582 def _descendants(repo, subset, x, followfirst=False): 582 def _descendants(repo, subset, x, followfirst=False):
583 args = getset(repo, list(repo), x) 583 args = getset(repo, list(repo), x)
584 if not args: 584 if not args:
585 return [] 585 return []
586 s = set(_revdescendants(repo, args, followfirst)) | set(args) 586 s = set(_revdescendants(repo, args, followfirst)) | set(args)
587
588 if len(subset) == len(repo):
589 # the passed in revisions may not exist, -1 for example
590 for arg in args:
591 if arg not in subset:
592 s.remove(arg)
593 return list(s)
594
595 return [r for r in subset if r in s] 587 return [r for r in subset if r in s]
596 588
597 def descendants(repo, subset, x): 589 def descendants(repo, subset, x):
598 """``descendants(set)`` 590 """``descendants(set)``
599 Changesets which are descendants of changesets in set. 591 Changesets which are descendants of changesets in set.
1347 def roots(repo, subset, x): 1339 def roots(repo, subset, x):
1348 """``roots(set)`` 1340 """``roots(set)``
1349 Changesets in set with no parent changeset in set. 1341 Changesets in set with no parent changeset in set.
1350 """ 1342 """
1351 s = set(getset(repo, repo.changelog, x)) 1343 s = set(getset(repo, repo.changelog, x))
1352 if len(subset) == len(repo): 1344 subset = [r for r in subset if r in s]
1353 subset = s
1354 else:
1355 subset = [r for r in subset if r in s]
1356 cs = _children(repo, subset, s) 1345 cs = _children(repo, subset, s)
1357 return [r for r in subset if r not in cs] 1346 return [r for r in subset if r not in cs]
1358 1347
1359 def secret(repo, subset, x): 1348 def secret(repo, subset, x):
1360 """``secret()`` 1349 """``secret()``