Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 37389:bef863a09acd
stack: follow-up on the stack revset
Follow good-practice for defining the stack revset.
Differential Revision: https://phab.mercurial-scm.org/D3136
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Thu, 05 Apr 2018 17:58:58 +0200 |
parents | e32dfff71529 |
children | 0c6b1ec75b73 |
comparison
equal
deleted
inserted
replaced
37388:764ada920db5 | 37389:bef863a09acd |
---|---|
26 registrar, | 26 registrar, |
27 repoview, | 27 repoview, |
28 revsetlang, | 28 revsetlang, |
29 scmutil, | 29 scmutil, |
30 smartset, | 30 smartset, |
31 stack, | 31 stack as stackmod, |
32 util, | 32 util, |
33 ) | 33 ) |
34 from .utils import ( | 34 from .utils import ( |
35 dateutil, | 35 dateutil, |
36 stringutil, | 36 stringutil, |
1537 getargs(x, 0, 0, _("secret takes no arguments")) | 1537 getargs(x, 0, 0, _("secret takes no arguments")) |
1538 target = phases.secret | 1538 target = phases.secret |
1539 return _phase(repo, subset, target) | 1539 return _phase(repo, subset, target) |
1540 | 1540 |
1541 @predicate('stack([revs])', safe=True) | 1541 @predicate('stack([revs])', safe=True) |
1542 def _stack(repo, subset, x): | 1542 def stack(repo, subset, x): |
1543 # experimental revset for the stack of changesets or working directory | 1543 """Experimental revset for the stack of changesets or working directory |
1544 # parent | 1544 parent. (EXPERIMENTAL) |
1545 """ | |
1545 if x is None: | 1546 if x is None: |
1546 stacks = stack.getstack(repo, x) | 1547 stacks = stackmod.getstack(repo, x) |
1547 else: | 1548 else: |
1548 stacks = smartset.baseset([]) | 1549 stacks = smartset.baseset([]) |
1549 for revision in getset(repo, fullreposet(repo), x): | 1550 for revision in getset(repo, fullreposet(repo), x): |
1550 currentstack = stack.getstack(repo, revision) | 1551 currentstack = stackmod.getstack(repo, revision) |
1551 stacks = stacks + currentstack | 1552 stacks = stacks + currentstack |
1552 | 1553 |
1553 # Force to use the order of the stacks instead of the subset one | 1554 return subset & stacks |
1554 return stacks & subset | |
1555 | 1555 |
1556 def parentspec(repo, subset, x, n, order): | 1556 def parentspec(repo, subset, x, n, order): |
1557 """``set^0`` | 1557 """``set^0`` |
1558 The set. | 1558 The set. |
1559 ``set^1`` (or ``set^``), ``set^2`` | 1559 ``set^1`` (or ``set^``), ``set^2`` |