comparison mercurial/revset.py @ 17961:b0affcb67cba stable

revset: backed out changeset 54cedee86e51 This was causing clones of the hg repo to go from 12.4s to 14.7s.
author Matt Mackall <mpm@selenic.com>
date Mon, 26 Nov 2012 13:44:11 -0600
parents 54cedee86e51
children 83aa4359c49f
comparison
equal deleted inserted replaced
17952:54cedee86e51 17961:b0affcb67cba
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
582 return [r for r in subset if r in s] 574 return [r for r in subset if r in s]
583 575
584 def descendants(repo, subset, x): 576 def descendants(repo, subset, x):
585 """``descendants(set)`` 577 """``descendants(set)``
586 Changesets which are descendants of changesets in set. 578 Changesets which are descendants of changesets in set.
1334 def roots(repo, subset, x): 1326 def roots(repo, subset, x):
1335 """``roots(set)`` 1327 """``roots(set)``
1336 Changesets in set with no parent changeset in set. 1328 Changesets in set with no parent changeset in set.
1337 """ 1329 """
1338 s = set(getset(repo, repo.changelog, x)) 1330 s = set(getset(repo, repo.changelog, x))
1339 if len(subset) == len(repo): 1331 subset = [r for r in subset if r in s]
1340 subset = s
1341 else:
1342 subset = [r for r in subset if r in s]
1343 cs = _children(repo, subset, s) 1332 cs = _children(repo, subset, s)
1344 return [r for r in subset if r not in cs] 1333 return [r for r in subset if r not in cs]
1345 1334
1346 def secret(repo, subset, x): 1335 def secret(repo, subset, x):
1347 """``secret()`` 1336 """``secret()``