[PATCH 2 of 4 evolve-ext] evolve: add _nextcandidate a revset to get the target for hg evolve with no arg
Laurent Charignon
lcharignon at fb.com
Mon Jun 22 17:42:01 CDT 2015
# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1435010365 25200
# Mon Jun 22 14:59:25 2015 -0700
# Node ID 34f4e918c71d29989e08a053bf3a4bac7ee371f5
# Parent 79e0d7418fa3a9dd71e39b4865542838e63f40eb
evolve: add _nextcandidate a revset to get the target for hg evolve with no arg
This patch introduces the _nextcandidate revset. It is used to pick the next
candidate for evolution when running hg evolve with no argument.
diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -508,6 +508,20 @@ def _nextcandidates(repo):
yield successor
tovisit.append(successor)
+### Next revset symbol
+
+ at eh.revset('_nextcandidate')
+def _nextcandidate(repo, subset, x):
+ """Private revset that computes the next changeset that evolves on a non
+ obsolete descendant of ."""
+ revset.getargs(x, 0, 0, '_nextcandidate takes no arguments')
+ try:
+ # Pick only the first next candidate
+ u = _nextcandidates(repo).next()
+ return subset & set([u])
+ except StopIteration:
+ return revset.baseset(set())
+
### Troubled revset symbol
@eh.revset('troubled')
diff --git a/tests/test-stabilize-order.t b/tests/test-stabilize-order.t
--- a/tests/test-stabilize-order.t
+++ b/tests/test-stabilize-order.t
@@ -139,6 +139,12 @@ Test behaviour with --any
$ echo b >> b
$ hg amend
1 new unstable changesets
+ $ hg log -r "_nextcandidate()"
+ changeset: 9:65095d7d0dd5
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: addc
+
$ glog
@ 11:036cf654e942 at default(draft) addb
|
More information about the Mercurial-devel
mailing list