comparison mercurial/revset.py @ 39301:31c0ee6eb0ac

phase: expose a `_phase(idx)` revset Internally phase related revset are calling the `_phase` function. We expose it as an internal revset. This is useful to refer to phase in revset doing debatable things around the phase name.
author Boris Feld <boris.feld@octobus.net>
date Thu, 23 Aug 2018 01:48:26 +0200
parents 4fe8d1f077b8
children 1eb370761fa0
comparison
equal deleted inserted replaced
39300:1ea6772fb415 39301:31c0ee6eb0ac
1564 1564
1565 def _phase(repo, subset, *targets): 1565 def _phase(repo, subset, *targets):
1566 """helper to select all rev in <targets> phases""" 1566 """helper to select all rev in <targets> phases"""
1567 return repo._phasecache.getrevset(repo, targets, subset) 1567 return repo._phasecache.getrevset(repo, targets, subset)
1568 1568
1569 @predicate('_phase(idx)', safe=True)
1570 def phase(repo, subset, x):
1571 l = getargs(x, 1, 1, ("_phase requires one argument"))
1572 target = getinteger(l[0], ("_phase expects a number"))
1573 return _phase(repo, subset, target)
1574
1569 @predicate('draft()', safe=True) 1575 @predicate('draft()', safe=True)
1570 def draft(repo, subset, x): 1576 def draft(repo, subset, x):
1571 """Changeset in draft phase.""" 1577 """Changeset in draft phase."""
1572 # i18n: "draft" is a keyword 1578 # i18n: "draft" is a keyword
1573 getargs(x, 0, 0, _("draft takes no arguments")) 1579 getargs(x, 0, 0, _("draft takes no arguments"))