changeset 18071:bea754715961

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.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 12 Dec 2012 03:12:55 +0100
parents af632936d3d9
children 03604f46d48a
files mercurial/revset.py tests/test-obsolete-divergent.t
diffstat 2 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 ..