1642 else: |
1642 else: |
1643 up(parentrevs(r)) |
1643 up(parentrevs(r)) |
1644 ps -= set([node.nullrev]) |
1644 ps -= set([node.nullrev]) |
1645 return subset & ps |
1645 return subset & ps |
1646 |
1646 |
1647 def _phase(repo, subset, target): |
1647 def _phase(repo, subset, *targets): |
1648 """helper to select all rev in phase <target>""" |
1648 """helper to select all rev in <targets> phases""" |
1649 repo._phasecache.loadphaserevs(repo) # ensure phase's sets are loaded |
1649 s = repo._phasecache.getrevset(repo, targets) |
1650 if repo._phasecache._phasesets: |
1650 return subset & s |
1651 s = repo._phasecache._phasesets[target] - repo.changelog.filteredrevs |
|
1652 s = baseset(s) |
|
1653 s.sort() # set are non ordered, so we enforce ascending |
|
1654 return subset & s |
|
1655 else: |
|
1656 phase = repo._phasecache.phase |
|
1657 condition = lambda r: phase(repo, r) == target |
|
1658 return subset.filter(condition, condrepr=('<phase %r>', target), |
|
1659 cache=False) |
|
1660 |
1651 |
1661 @predicate('draft()', safe=True) |
1652 @predicate('draft()', safe=True) |
1662 def draft(repo, subset, x): |
1653 def draft(repo, subset, x): |
1663 """Changeset in draft phase.""" |
1654 """Changeset in draft phase.""" |
1664 # i18n: "draft" is a keyword |
1655 # i18n: "draft" is a keyword |
1715 |
1706 |
1716 # for internal use |
1707 # for internal use |
1717 @predicate('_notpublic', safe=True) |
1708 @predicate('_notpublic', safe=True) |
1718 def _notpublic(repo, subset, x): |
1709 def _notpublic(repo, subset, x): |
1719 getargs(x, 0, 0, "_notpublic takes no arguments") |
1710 getargs(x, 0, 0, "_notpublic takes no arguments") |
1720 repo._phasecache.loadphaserevs(repo) # ensure phase's sets are loaded |
1711 return _phase(repo, subset, phases.draft, phases.secret) |
1721 if repo._phasecache._phasesets: |
|
1722 s = set() |
|
1723 for u in repo._phasecache._phasesets[1:]: |
|
1724 s.update(u) |
|
1725 s = baseset(s - repo.changelog.filteredrevs) |
|
1726 s.sort() |
|
1727 return subset & s |
|
1728 else: |
|
1729 phase = repo._phasecache.phase |
|
1730 target = phases.public |
|
1731 condition = lambda r: phase(repo, r) != target |
|
1732 return subset.filter(condition, condrepr=('<phase %r>', target), |
|
1733 cache=False) |
|
1734 |
1712 |
1735 @predicate('public()', safe=True) |
1713 @predicate('public()', safe=True) |
1736 def public(repo, subset, x): |
1714 def public(repo, subset, x): |
1737 """Changeset in public phase.""" |
1715 """Changeset in public phase.""" |
1738 # i18n: "public" is a keyword |
1716 # i18n: "public" is a keyword |