mercurial/revset.py
changeset 30332 318a24b52eeb
parent 30227 5ee944b9c750
child 30392 155d7ea98085
equal deleted inserted replaced
30331:b19291e5d506 30332:318a24b52eeb
  1441     else:
  1441     else:
  1442         exclude = getset(repo, fullreposet(repo), args[1])
  1442         exclude = getset(repo, fullreposet(repo), args[1])
  1443 
  1443 
  1444     results = set(cl.findmissingrevs(common=exclude, heads=include))
  1444     results = set(cl.findmissingrevs(common=exclude, heads=include))
  1445     # XXX we should turn this into a baseset instead of a set, smartset may do
  1445     # XXX we should turn this into a baseset instead of a set, smartset may do
  1446     # some optimisations from the fact this is a baseset.
  1446     # some optimizations from the fact this is a baseset.
  1447     return subset & results
  1447     return subset & results
  1448 
  1448 
  1449 @predicate('origin([set])', safe=True)
  1449 @predicate('origin([set])', safe=True)
  1450 def origin(repo, subset, x):
  1450 def origin(repo, subset, x):
  1451     """
  1451     """
  1473             src = prev
  1473             src = prev
  1474 
  1474 
  1475     o = set([_firstsrc(r) for r in dests])
  1475     o = set([_firstsrc(r) for r in dests])
  1476     o -= set([None])
  1476     o -= set([None])
  1477     # XXX we should turn this into a baseset instead of a set, smartset may do
  1477     # XXX we should turn this into a baseset instead of a set, smartset may do
  1478     # some optimisations from the fact this is a baseset.
  1478     # some optimizations from the fact this is a baseset.
  1479     return subset & o
  1479     return subset & o
  1480 
  1480 
  1481 @predicate('outgoing([path])', safe=True)
  1481 @predicate('outgoing([path])', safe=True)
  1482 def outgoing(repo, subset, x):
  1482 def outgoing(repo, subset, x):
  1483     """Changesets not found in the specified destination repository, or the
  1483     """Changesets not found in the specified destination repository, or the
  1519     cl = repo.changelog
  1519     cl = repo.changelog
  1520     for r in getset(repo, fullreposet(repo), x):
  1520     for r in getset(repo, fullreposet(repo), x):
  1521         ps.add(cl.parentrevs(r)[0])
  1521         ps.add(cl.parentrevs(r)[0])
  1522     ps -= set([node.nullrev])
  1522     ps -= set([node.nullrev])
  1523     # XXX we should turn this into a baseset instead of a set, smartset may do
  1523     # XXX we should turn this into a baseset instead of a set, smartset may do
  1524     # some optimisations from the fact this is a baseset.
  1524     # some optimizations from the fact this is a baseset.
  1525     return subset & ps
  1525     return subset & ps
  1526 
  1526 
  1527 @predicate('p2([set])', safe=True)
  1527 @predicate('p2([set])', safe=True)
  1528 def p2(repo, subset, x):
  1528 def p2(repo, subset, x):
  1529     """Second parent of changesets in set, or the working directory.
  1529     """Second parent of changesets in set, or the working directory.
  1542     cl = repo.changelog
  1542     cl = repo.changelog
  1543     for r in getset(repo, fullreposet(repo), x):
  1543     for r in getset(repo, fullreposet(repo), x):
  1544         ps.add(cl.parentrevs(r)[1])
  1544         ps.add(cl.parentrevs(r)[1])
  1545     ps -= set([node.nullrev])
  1545     ps -= set([node.nullrev])
  1546     # XXX we should turn this into a baseset instead of a set, smartset may do
  1546     # XXX we should turn this into a baseset instead of a set, smartset may do
  1547     # some optimisations from the fact this is a baseset.
  1547     # some optimizations from the fact this is a baseset.
  1548     return subset & ps
  1548     return subset & ps
  1549 
  1549 
  1550 def parentpost(repo, subset, x, order):
  1550 def parentpost(repo, subset, x, order):
  1551     return p1(repo, subset, x)
  1551     return p1(repo, subset, x)
  1552 
  1552 
  3196         return False
  3196         return False
  3197 
  3197 
  3198     def __len__(self):
  3198     def __len__(self):
  3199         # Basic implementation to be changed in future patches.
  3199         # Basic implementation to be changed in future patches.
  3200         # until this gets improved, we use generator expression
  3200         # until this gets improved, we use generator expression
  3201         # here, since list compr is free to call __len__ again
  3201         # here, since list comprehensions are free to call __len__ again
  3202         # causing infinite recursion
  3202         # causing infinite recursion
  3203         l = baseset(r for r in self)
  3203         l = baseset(r for r in self)
  3204         return len(l)
  3204         return len(l)
  3205 
  3205 
  3206     def sort(self, reverse=False):
  3206     def sort(self, reverse=False):