strip: do not include obsolescence markers for the temporary bundle
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 01 Jun 2017 12:08:49 +0200
changeset 32651 5732e6d2b369
parent 32650 b36b02d57021
child 32652 71eb6a098315
strip: do not include obsolescence markers for the temporary bundle When stripping, we need to put all non-stripped revisions "above" the stripped ones in a "temporary-bundle" while we strip the targets revision. Then we reapply that bundle to restore these non-stripped revisions (with a new revision numbers). We skip the inclusion of obsolescence markers in that bundle. This is safe since all obsmarkers we plan to strip will be backed-up in the strip backup bundle. Including the markers would create issue in some case were we try to strip a prune markers that is "relevant" to a revision in the "temporary-bundle". (note: we do not strip obsmarkers yet)
mercurial/repair.py
--- a/mercurial/repair.py	Thu Jun 01 08:44:01 2017 +0200
+++ b/mercurial/repair.py	Thu Jun 01 12:08:49 2017 +0200
@@ -23,7 +23,7 @@
     util,
 )
 
-def _bundle(repo, bases, heads, node, suffix, compress=True):
+def _bundle(repo, bases, heads, node, suffix, compress=True, obsolescence=True):
     """create a bundle with the specified revisions as a backup"""
 
     backupdir = "strip-backup"
@@ -49,7 +49,7 @@
         bundletype = "HG10UN"
 
     outgoing = discovery.outgoing(repo, missingroots=bases, missingheads=heads)
-    contentopts = {'cg.version': cgversion, 'obsolescence': True}
+    contentopts = {'cg.version': cgversion, 'obsolescence': obsolescence}
     return bundle2.writenewbundle(repo.ui, repo, 'strip', name, bundletype,
                                   outgoing, contentopts, vfs, compression=comp)
 
@@ -150,8 +150,13 @@
     tmpbundlefile = None
     if saveheads:
         # do not compress temporary bundle if we remove it from disk later
+        #
+        # We do not include obsolescence, it might re-introduce prune markers
+        # we are trying to strip.  This is harmless since the stripped markers
+        # are already backed up and we did not touched the markers for the
+        # saved changesets.
         tmpbundlefile = _bundle(repo, savebases, saveheads, node, 'temp',
-                            compress=False)
+                                compress=False, obsolescence=False)
 
     mfst = repo.manifestlog._revlog