changeset 51124:80bda4254b84

unstable: do not consider internal phases when computing unstable The revisions that are not part of the "working" set by other means should not be considered for the evolution related computation. This impact the test introduced in 5f9af8422b31 as this is actually a more semantic fix of the issue.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 06 Nov 2023 23:17:10 +0100
parents 5d740f920640
children 4224b1aa7ad8 1625fe807c04
files mercurial/obsolete.py mercurial/phases.py tests/test-phases.t
diffstat 3 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/obsolete.py	Mon Nov 06 23:15:58 2023 +0100
+++ b/mercurial/obsolete.py	Mon Nov 06 23:17:10 2023 +0100
@@ -939,7 +939,7 @@
 
 def _mutablerevs(repo):
     """the set of mutable revision in the repository"""
-    return repo._phasecache.getrevset(repo, phases.mutablephases)
+    return repo._phasecache.getrevset(repo, phases.relevant_mutable_phases)
 
 
 @cachefor(b'obsolete')
--- a/mercurial/phases.py	Mon Nov 06 23:15:58 2023 +0100
+++ b/mercurial/phases.py	Mon Nov 06 23:17:10 2023 +0100
@@ -165,6 +165,7 @@
 phasenumber2.update({b'%i' % phase: phase for phase in phasenames})
 # record phase property
 mutablephases = (draft, secret, archived, internal)
+relevant_mutable_phases = (draft, secret)  # could be obsolete or unstable
 remotehiddenphases = (secret, archived, internal)
 localhiddenphases = (internal, archived)
 
--- a/tests/test-phases.t	Mon Nov 06 23:15:58 2023 +0100
+++ b/tests/test-phases.t	Mon Nov 06 23:17:10 2023 +0100
@@ -1001,18 +1001,20 @@
      summary:     A
   
 The hidden commit is an orphan but doesn't show up without --hidden
+And internal changesets are not considered for unstability.
 
   $ hg debugobsolete `hg id --debug -ir 0`
   1 new obsolescence markers
   obsoleted 1 changesets
-  $ hg --hidden log -G -r 'unstable()'
-  *  changeset:   1:c01c42dffc7f
+  $ hg --hidden log -G -r '(0::) - 0'
+  o  changeset:   1:c01c42dffc7f
   |  tag:         tip
   ~  user:        test
      date:        Thu Jan 01 00:00:00 1970 +0000
-     instability: orphan
      summary:     my test internal commit
   
+  $ hg --hidden log -G -r 'unstable()'
+
   $ hg log -G -r 'unstable()'