obsolete: add revset and test for divergent changesets
This changesets add a new `divergent()` revset similar to `unstable()` and
`bumped()` one. Introducting this revset allows actuall test of the divergent
detection.
--- a/mercurial/revset.py Wed Dec 12 03:19:30 2012 +0100
+++ b/mercurial/revset.py Wed Dec 12 03:12:55 2012 +0100
@@ -646,6 +646,15 @@
return [r for r in subset if r in dests]
+def divergent(repo, subset, x):
+ """``divergent()``
+ Final successors of changesets with an alternative set of final successors.
+ """
+ # i18n: "divergent" is a keyword
+ getargs(x, 0, 0, _("divergent takes no arguments"))
+ divergent = obsmod.getrevs(repo, 'divergent')
+ return [r for r in subset if r in divergent]
+
def draft(repo, subset, x):
"""``draft()``
Changeset in draft phase."""
@@ -1541,6 +1550,7 @@
"descendants": descendants,
"_firstdescendants": _firstdescendants,
"destination": destination,
+ "divergent": divergent,
"draft": draft,
"extinct": extinct,
"extra": extra,
--- a/tests/test-obsolete-divergent.t Wed Dec 12 03:19:30 2012 +0100
+++ b/tests/test-obsolete-divergent.t Wed Dec 12 03:12:55 2012 +0100
@@ -81,6 +81,9 @@
82623d38b9ba
392fd25390da
392fd25390da
+ $ hg log -r 'divergent()'
+ 2:82623d38b9ba A_1
+ 3:392fd25390da A_2
$ cd ..
@@ -116,6 +119,9 @@
01f36c5a8fda
01f36c5a8fda
01f36c5a8fda
+ $ hg log -r 'divergent()'
+ 2:82623d38b9ba A_1
+ 4:01f36c5a8fda A_3
$ cd ..
@@ -145,6 +151,9 @@
82623d38b9ba
392fd25390da
392fd25390da
+ $ hg log -r 'divergent()'
+ 2:82623d38b9ba A_1
+ 3:392fd25390da A_2
$ cd ..
do not take unknown node in account if they are final
@@ -195,6 +204,7 @@
01f36c5a8fda
01f36c5a8fda
01f36c5a8fda
+ $ hg log -r 'divergent()'
$ cd ..
split is not divergences
@@ -220,6 +230,7 @@
82623d38b9ba
392fd25390da
392fd25390da
+ $ hg log -r 'divergent()'
Even when subsequente rewriting happen
@@ -266,6 +277,7 @@
e442cfc57690
e442cfc57690
e442cfc57690
+ $ hg log -r 'divergent()'
Check more complexe obsolescence graft (with divergence)
@@ -334,6 +346,11 @@
14608b260df8
bed64f5d2f5a
bed64f5d2f5a
+ $ hg log -r 'divergent()'
+ 4:01f36c5a8fda A_3
+ 8:7ae126973a96 A_7
+ 9:14608b260df8 A_8
+ 10:bed64f5d2f5a A_9
fix the divergence
@@ -393,6 +410,7 @@
a139f71be9da
a139f71be9da
a139f71be9da
+ $ hg log -r 'divergent()'
$ cd ..