changeset 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 1ea6772fb415
children b17d27ea61fb
files mercurial/revset.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Thu Aug 23 01:15:19 2018 +0200
+++ b/mercurial/revset.py	Thu Aug 23 01:48:26 2018 +0200
@@ -1566,6 +1566,12 @@
     """helper to select all rev in <targets> 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."""