changeset 44691:48b99af7b4b3

revset: import `unstable()` from the evolve extension Differential Revision: https://phab.mercurial-scm.org/D8404
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 13 Apr 2020 01:19:09 -0400
parents 44aff45b556d
children 61fda2dbc522
files mercurial/revset.py tests/test-obsolete-divergent.t tests/test-obsolete.t
diffstat 3 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Fri Apr 10 22:33:14 2020 +0200
+++ b/mercurial/revset.py	Mon Apr 13 01:19:09 2020 -0400
@@ -2507,6 +2507,21 @@
     return subset & orphan
 
 
+@predicate(b'unstable()', safe=True)
+def unstable(repo, subset, x):
+    """Changesets with instabilities. (EXPERIMENTAL)
+    """
+    # i18n: "unstable" is a keyword
+    getargs(x, 0, 0, b'unstable takes no arguments')
+    _unstable = set()
+    _unstable.update(obsmod.getrevs(repo, b'orphan'))
+    _unstable.update(obsmod.getrevs(repo, b'phasedivergent'))
+    _unstable.update(obsmod.getrevs(repo, b'contentdivergent'))
+    _unstable = baseset(_unstable)
+    _unstable.sort()  # set is non-ordered, enforce order
+    return subset & _unstable
+
+
 @predicate(b'user(string)', safe=True, weight=10)
 def user(repo, subset, x):
     """User name contains string. The match is case-insensitive.
--- a/tests/test-obsolete-divergent.t	Fri Apr 10 22:33:14 2020 +0200
+++ b/tests/test-obsolete-divergent.t	Mon Apr 13 01:19:09 2020 -0400
@@ -91,6 +91,9 @@
   $ hg log -r 'contentdivergent()'
   2:82623d38b9ba A_1
   3:392fd25390da A_2
+  $ hg log -r 'unstable()'
+  2:82623d38b9ba A_1
+  3:392fd25390da A_2
   $ hg debugsuccessorssets 'all()' --closest
   d20a80d4def3
       d20a80d4def3
--- a/tests/test-obsolete.t	Fri Apr 10 22:33:14 2020 +0200
+++ b/tests/test-obsolete.t	Mon Apr 13 01:19:09 2020 -0400
@@ -224,6 +224,9 @@
   |
   o  0:1f0dee641bb7 (public) [ ] add a
   
+  $ hg log -r 'unstable()'
+  5:5601fb93a350 (draft phase-divergent) [tip ] add new_3_c
+
 
 And that bumped changeset are detected
 --------------------------------------
@@ -582,6 +585,8 @@
   1 new obsolescence markers
   obsoleted 1 changesets
   1 new orphan changesets
+  $ hg log -r 'unstable()'
+  5:cda648ca50f5 (draft orphan) [tip ] add original_e
   $ hg debugobsolete | grep `getid original_d`
   94b33453f93bdb8d457ef9b770851a618bf413e1 0 {6f96419950729f3671185b847352890f074f7557} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   $ hg log -r 'obsolete()'