diff mercurial/revset.py @ 37004:407934a97bc7

stack: import Evolve stack test file Import Evolve stack test file for starting to have good coverage on stack definition. Differential Revision: https://phab.mercurial-scm.org/D2396
author Boris Feld <boris.feld@octobus.net>
date Fri, 19 Jan 2018 16:52:02 +0100
parents c6061cadb400
children f0b6fbea00cf
line wrap: on
line diff
--- a/mercurial/revset.py	Fri Jan 19 15:25:06 2018 +0100
+++ b/mercurial/revset.py	Fri Jan 19 16:52:02 2018 +0100
@@ -28,6 +28,7 @@
     revsetlang,
     scmutil,
     smartset,
+    stack,
     util,
 )
 from .utils import dateutil
@@ -1532,6 +1533,21 @@
     target = phases.secret
     return _phase(repo, subset, target)
 
+@predicate('stack([revs])', safe=True)
+def _stack(repo, subset, x):
+    # experimental revset for the stack of changesets or working directory
+    # parent
+    if x is None:
+        stacks = stack.getstack(repo, x)
+    else:
+        stacks = smartset.baseset([])
+        for revision in getset(repo, fullreposet(repo), x):
+            currentstack = stack.getstack(repo, revision)
+            stacks = stacks + currentstack
+
+    # Force to use the order of the stacks instead of the subset one
+    return stacks & subset
+
 def parentspec(repo, subset, x, n, order):
     """``set^0``
     The set.