Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revset.py @ 25554:94441df6206c
revset: mark spots that use 'set' instead of 'smartset'
Using smartset is better because we can do more optimisation on it. So we are
marking the faulty spot for later processing.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 11 Jun 2015 15:45:02 -0700 |
parents | fa2e91d00e4c |
children | 15412bba5a68 |
comparison
equal
deleted
inserted
replaced
25553:fa2e91d00e4c | 25554:94441df6206c |
---|---|
1351 if not rev in descendants and not rev in include] | 1351 if not rev in descendants and not rev in include] |
1352 else: | 1352 else: |
1353 exclude = getset(repo, fullreposet(repo), args[1]) | 1353 exclude = getset(repo, fullreposet(repo), args[1]) |
1354 | 1354 |
1355 results = set(cl.findmissingrevs(common=exclude, heads=include)) | 1355 results = set(cl.findmissingrevs(common=exclude, heads=include)) |
1356 # XXX we should turn this into a baseset instead of a set, smartset may do | |
1357 # some optimisations from the fact this is a baseset. | |
1356 return subset & results | 1358 return subset & results |
1357 | 1359 |
1358 def origin(repo, subset, x): | 1360 def origin(repo, subset, x): |
1359 """``origin([set])`` | 1361 """``origin([set])`` |
1360 Changesets that were specified as a source for the grafts, transplants or | 1362 Changesets that were specified as a source for the grafts, transplants or |
1380 return src | 1382 return src |
1381 src = prev | 1383 src = prev |
1382 | 1384 |
1383 o = set([_firstsrc(r) for r in dests]) | 1385 o = set([_firstsrc(r) for r in dests]) |
1384 o -= set([None]) | 1386 o -= set([None]) |
1387 # XXX we should turn this into a baseset instead of a set, smartset may do | |
1388 # some optimisations from the fact this is a baseset. | |
1385 return subset & o | 1389 return subset & o |
1386 | 1390 |
1387 def outgoing(repo, subset, x): | 1391 def outgoing(repo, subset, x): |
1388 """``outgoing([path])`` | 1392 """``outgoing([path])`` |
1389 Changesets not found in the specified destination repository, or the | 1393 Changesets not found in the specified destination repository, or the |
1422 ps = set() | 1426 ps = set() |
1423 cl = repo.changelog | 1427 cl = repo.changelog |
1424 for r in getset(repo, fullreposet(repo), x): | 1428 for r in getset(repo, fullreposet(repo), x): |
1425 ps.add(cl.parentrevs(r)[0]) | 1429 ps.add(cl.parentrevs(r)[0]) |
1426 ps -= set([node.nullrev]) | 1430 ps -= set([node.nullrev]) |
1431 # XXX we should turn this into a baseset instead of a set, smartset may do | |
1432 # some optimisations from the fact this is a baseset. | |
1427 return subset & ps | 1433 return subset & ps |
1428 | 1434 |
1429 def p2(repo, subset, x): | 1435 def p2(repo, subset, x): |
1430 """``p2([set])`` | 1436 """``p2([set])`` |
1431 Second parent of changesets in set, or the working directory. | 1437 Second parent of changesets in set, or the working directory. |
1443 ps = set() | 1449 ps = set() |
1444 cl = repo.changelog | 1450 cl = repo.changelog |
1445 for r in getset(repo, fullreposet(repo), x): | 1451 for r in getset(repo, fullreposet(repo), x): |
1446 ps.add(cl.parentrevs(r)[1]) | 1452 ps.add(cl.parentrevs(r)[1]) |
1447 ps -= set([node.nullrev]) | 1453 ps -= set([node.nullrev]) |
1454 # XXX we should turn this into a baseset instead of a set, smartset may do | |
1455 # some optimisations from the fact this is a baseset. | |
1448 return subset & ps | 1456 return subset & ps |
1449 | 1457 |
1450 def parents(repo, subset, x): | 1458 def parents(repo, subset, x): |
1451 """``parents([set])`` | 1459 """``parents([set])`` |
1452 The set of all parents for all changesets in set, or the working directory. | 1460 The set of all parents for all changesets in set, or the working directory. |
1505 getargs(x, 0, 0, "_notpublic takes no arguments") | 1513 getargs(x, 0, 0, "_notpublic takes no arguments") |
1506 if repo._phasecache._phasesets: | 1514 if repo._phasecache._phasesets: |
1507 s = set() | 1515 s = set() |
1508 for u in repo._phasecache._phasesets[1:]: | 1516 for u in repo._phasecache._phasesets[1:]: |
1509 s.update(u) | 1517 s.update(u) |
1518 # XXX we should turn this into a baseset instead of a set, smartset may | |
1519 # do some optimisations from the fact this is a baseset. | |
1510 return subset & s | 1520 return subset & s |
1511 else: | 1521 else: |
1512 phase = repo._phasecache.phase | 1522 phase = repo._phasecache.phase |
1513 target = phases.public | 1523 target = phases.public |
1514 condition = lambda r: phase(repo, r) != target | 1524 condition = lambda r: phase(repo, r) != target |