diff mercurial/commands.py @ 50398:cc712ce3361f

bundle: abort if the user request bundling of internal changesets See inline comments for details.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 10 Mar 2023 07:19:25 +0100
parents d68462736492
children c5e93c915ab6
line wrap: on
line diff
--- 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