mercurial/commands.py
changeset 50317 cc712ce3361f
parent 50309 d68462736492
child 50335 c5e93c915ab6
--- a/mercurial/commands.py	Fri Mar 10 07:10:19 2023 +0100
+++ b/mercurial/commands.py	Fri Mar 10 07:19:25 2023 +0100
@@ -1665,6 +1665,14 @@
         scmutil.nochangesfound(ui, repo, not base and excluded)
         return 1
 
+    # internal changeset are internal implementation details that should not
+    # leave the repository. Bundling with `hg bundle` create such risk.
+    bundled_internal = repo.revs(b"%ln and _internal()", missing)
+    if bundled_internal:
+        msg = _(b"cannot bundle internal changesets")
+        hint = _(b"%d internal changesets selected") % len(bundled_internal)
+        raise error.Abort(msg, hint=hint)
+
     if heads:
         outgoing = discovery.outgoing(
             repo, missingroots=missing, ancestorsof=heads