Patchwork D8404: revset: import `unstable()` from the evolve extension

login
register
mail settings
Submitter phabricator
Date April 13, 2020, 5:26 a.m.
Message ID <differential-rev-PHID-DREV-ahrwkubh3zytjtr2oltv-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46070/
State Superseded
Headers show

Comments

phabricator - April 13, 2020, 5:26 a.m.
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8404

AFFECTED FILES
  mercurial/revset.py
  tests/test-obsolete-divergent.t
  tests/test-obsolete.t

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: mercurial-devel
phabricator - April 13, 2020, 2 p.m.
pulkit added inline comments.

INLINE COMMENTS

> revset.py:2512
> +def unstable(repo, subset, x):
> +    """Changesets with instabilities.
> +    """

`(EXPERIMENTAL)` needs to be appended since the whole thing is experimental.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8404/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8404

To: mharbison72, #hg-reviewers
Cc: pulkit, mercurial-devel
phabricator - April 13, 2020, 4:26 p.m.
mharbison72 added inline comments.

INLINE COMMENTS

> pulkit wrote in revset.py:2512
> `(EXPERIMENTAL)` needs to be appended since the whole thing is experimental.

Good catch.  There are a couple others like this too.  I'll leave `hidden()` as not experimental, because `--hidden` is also not marked experimental (though it does require `-v` to display its help).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8404/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8404

To: mharbison72, #hg-reviewers
Cc: pulkit, mercurial-devel

Patch

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()'
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/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.