Mercurial > public > mercurial-scm > hg-stable
diff mercurial/bundle2.py @ 50433:bcf54837241d
bundle: prevent implicite bundling of internal changeset
Now that the two mains source of on-disk bundle are preventing the inclusion of
internal changesets in their bundling. We can add a lower level check that
would prevent any other leakage of internal-phase changesets.
We keep the door open to some usage, like the temporary bundle using during
strip for example.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 08 Mar 2023 11:01:11 +0100 |
parents | 385a4f8056e5 |
children | cd2a2963b982 |
line wrap: on
line diff
--- a/mercurial/bundle2.py Fri Mar 10 07:19:25 2023 +0100 +++ b/mercurial/bundle2.py Wed Mar 08 11:01:11 2023 +0100 @@ -1703,6 +1703,7 @@ vfs=None, compression=None, compopts=None, + allow_internal=False, ): if bundletype.startswith(b'HG10'): cg = changegroup.makechangegroup(repo, outgoing, b'01', source) @@ -1718,6 +1719,14 @@ elif not bundletype.startswith(b'HG20'): raise error.ProgrammingError(b'unknown bundle type: %s' % bundletype) + # enforce that no internal phase are to be bundled + bundled_internal = repo.revs(b"%ln and _internal()", outgoing.ancestorsof) + if bundled_internal and not allow_internal: + count = len(repo.revs(b'%ln and _internal()', outgoing.missing)) + msg = "backup bundle would contains %d internal changesets" + msg %= count + raise error.ProgrammingError(msg) + caps = {} if opts.get(b'obsolescence', False): caps[b'obsmarkers'] = (b'V1',)