diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2507,6 +2507,21 @@ return subset & orphan +@predicate(b'unstable()', safe=True) +def unstable(repo, subset, x): + """Changesets with instabilities. + """ + # 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. diff --git a/tests/test-obsolete-divergent.t b/tests/test-obsolete-divergent.t --- a/tests/test-obsolete-divergent.t +++ b/tests/test-obsolete-divergent.t @@ -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 diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t --- a/tests/test-obsolete.t +++ b/tests/test-obsolete.t @@ -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()'