changeset 50430:386737600689

revset: add `_internal()` predicate This predicate help core code to select internal changeset (in the internal phase).
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 08 Mar 2023 11:00:30 +0100
parents 71a2c061865d
children f24c2e42e654
files mercurial/phases.py mercurial/revset.py
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/phases.py	Fri Mar 10 03:41:18 2023 +0100
+++ b/mercurial/phases.py	Wed Mar 08 11:00:30 2023 +0100
@@ -172,6 +172,10 @@
 remotehiddenphases = (secret, archived, internal)
 localhiddenphases = (internal, archived)
 
+all_internal_phases = tuple(p for p in allphases if p & internal)
+# We do not want any internal content to exit the repository, ever.
+no_bundle_phases = all_internal_phases
+
 
 def supportinternal(repo):
     # type: (localrepo.localrepository) -> bool
--- a/mercurial/revset.py	Fri Mar 10 03:41:18 2023 +0100
+++ b/mercurial/revset.py	Wed Mar 08 11:00:30 2023 +0100
@@ -1967,6 +1967,12 @@
     return repo._phasecache.getrevset(repo, targets, subset)
 
 
+@predicate(b'_internal()', safe=True)
+def _internal(repo, subset, x):
+    getargs(x, 0, 0, _(b"_internal takes no arguments"))
+    return _phase(repo, subset, *phases.all_internal_phases)
+
+
 @predicate(b'_phase(idx)', safe=True)
 def phase(repo, subset, x):
     l = getargs(x, 1, 1, b"_phase requires one argument")