Patchwork [6,of,7] strip: do not include obsolescence markers for the temporary bundle

mail settings
Submitter Pierre-Yves David
Date June 1, 2017, 1:39 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/21121/
State Accepted
Headers show


Pierre-Yves David - June 1, 2017, 1:39 p.m.
# HG changeset patch
# User Pierre-Yves David <>
# Date 1496311729 -7200
#      Thu Jun 01 12:08:49 2017 +0200
# Node ID 2c44bd45fdeeb3a8bf1762af4a81af3914fadc29
# Parent  4b29601f6fa45ffbc3e72e6b2339a1786d59178b
# EXP-Topic obsstrip
# Available At
#              hg pull -r 2c44bd45fdee
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

(note: we do not strip obsmarkers yet)


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -23,7 +23,7 @@  from . import (
-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 @@  def _bundle(repo, bases, heads, node, su
         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 @@  def strip(ui, repo, nodelist, backup=Tru
     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