comparison mercurial/revset.py @ 17953:49c85541617b

Merge with crew-stable
author Bryan O'Sullivan <bryano@fb.com>
date Tue, 20 Nov 2012 10:09:06 -0800
parents 03e552aaae67 54cedee86e51
children 83aa4359c49f
comparison
equal deleted inserted replaced
17950:a1f94e2f5da2 17953:49c85541617b
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
587 return [r for r in subset if r in s] 595 return [r for r in subset if r in s]
588 596
589 def descendants(repo, subset, x): 597 def descendants(repo, subset, x):
590 """``descendants(set)`` 598 """``descendants(set)``
591 Changesets which are descendants of changesets in set. 599 Changesets which are descendants of changesets in set.
1339 def roots(repo, subset, x): 1347 def roots(repo, subset, x):
1340 """``roots(set)`` 1348 """``roots(set)``
1341 Changesets in set with no parent changeset in set. 1349 Changesets in set with no parent changeset in set.
1342 """ 1350 """
1343 s = set(getset(repo, repo.changelog, x)) 1351 s = set(getset(repo, repo.changelog, x))
1344 subset = [r for r in subset if r in s] 1352 if len(subset) == len(repo):
1353 subset = s
1354 else:
1355 subset = [r for r in subset if r in s]
1345 cs = _children(repo, subset, s) 1356 cs = _children(repo, subset, s)
1346 return [r for r in subset if r not in cs] 1357 return [r for r in subset if r not in cs]
1347 1358
1348 def secret(repo, subset, x): 1359 def secret(repo, subset, x):
1349 """``secret()`` 1360 """``secret()``