# HG changeset patch # User Pierre-Yves David # Date 1678370819 -3600 # Node ID 7a017cd07a1ea866712c1ef69499227897ebde8e # Parent f95ab2c5330340639c9e568f36cdd51d3e3786b0 strip: explicitly compute the boundary of the backup bundle We want to make change to the set of backed up revision in a future changeset, we start with a change of the computation without any changes in the semantic to clarify later changeset. The could of costly assert are here to testify that the result is still correct. They will be removed in the next changesets, but I wanted them in this changeset to help in case someone bisect a regression to this changeset in the future. diff -r f95ab2c53303 -r 7a017cd07a1e mercurial/repair.py --- a/mercurial/repair.py Fri Mar 10 04:04:10 2023 +0100 +++ b/mercurial/repair.py Thu Mar 09 15:06:59 2023 +0100 @@ -349,8 +349,25 @@ def _createstripbackup(repo, stripbases, node, topic): # backup the changeset we are about to strip vfs = repo.vfs - cl = repo.changelog - backupfile = backupbundle(repo, stripbases, cl.heads(), node, topic) + unfi = repo.unfiltered() + to_node = unfi.changelog.node + all_backup = unfi.revs( + b"(%ln)::(%ld)", stripbases, unfi.changelog.headrevs() + ) + if not all_backup: + return None + + def to_nodes(revs): + return [to_node(r) for r in revs] + + simpler_bases = to_nodes( + unfi.revs("roots(%ln::%ln)", stripbases, stripbases) + ) + bases = to_nodes(unfi.revs("roots(%ld)", all_backup)) + heads = to_nodes(unfi.revs("heads(%ld)", all_backup)) + assert bases == simpler_bases + assert set(heads).issubset(set(repo.changelog.heads())) + backupfile = backupbundle(repo, bases, heads, node, topic) repo.ui.status(_(b"saved backup bundle to %s\n") % vfs.join(backupfile)) repo.ui.log( b"backupbundle", b"saved backup bundle to %s\n", vfs.join(backupfile)