# HG changeset patch # User Boris Feld # Date 2018-08-22 23:48:26 # Node ID 31c0ee6eb0acbb532d63cf80f3e90ae9237be67f # Parent 1ea6772fb415536963c1bafa42fe017c64204856 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. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -1566,6 +1566,12 @@ def _phase(repo, subset, *targets): """helper to select all rev in phases""" return repo._phasecache.getrevset(repo, targets, subset) +@predicate('_phase(idx)', safe=True) +def phase(repo, subset, x): + l = getargs(x, 1, 1, ("_phase requires one argument")) + target = getinteger(l[0], ("_phase expects a number")) + return _phase(repo, subset, target) + @predicate('draft()', safe=True) def draft(repo, subset, x): """Changeset in draft phase."""