changeset 32629:71eb6a098315

strip: strip obsmarkers exclusive to the stripped changeset This is it, `hg strip --rev X` will now also remove obsolescence markers exclusive to X. Since a previous changeset, the obsmarkers has been backed up in the strip backup bundle, so it is possible to restore them. Note: stripping obsmarkers means the precursors of the stripped changeset might no longer be obsolete after the strip. Stripping changeset without obsmarkers can be useful when building test case. So It is possible to disable the stripping of obsmarkers using the 'devel.strip-obsmarkers' config option. Test change have been carefully validated.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 20 May 2017 16:19:59 +0200
parents 5732e6d2b369
children 53f47cc085d8
files mercurial/repair.py tests/test-obsolete-bundle-strip.t tests/test-obsolete.t tests/test-subrepo-missing.t tests/testlib/exchange-obsmarker-util.sh
diffstat 5 files changed, 196 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/repair.py	Thu Jun 01 12:08:49 2017 +0200
+++ b/mercurial/repair.py	Sat May 20 16:19:59 2017 +0200
@@ -122,6 +122,13 @@
     savebases = [cl.node(r) for r in saverevs]
     stripbases = [cl.node(r) for r in tostrip]
 
+    stripobsidx = obsmarkers = ()
+    if repo.ui.configbool('devel', 'strip-obsmarkers', True):
+        obsmarkers = obsolete.exclusivemarkers(repo, stripbases)
+    if obsmarkers:
+        stripobsidx = [i for i, m in enumerate(repo.obsstore)
+                       if m in obsmarkers]
+
     # For a set s, max(parents(s) - s) is the same as max(heads(::s - s)), but
     # is much faster
     newbmtarget = repo.revs('max(parents(%ld) - (%ld))', tostrip, tostrip)
@@ -185,6 +192,9 @@
                 if troffset == 0:
                     repo.store.markremoved(file)
 
+            deleteobsmarkers(repo.obsstore, stripobsidx)
+            del repo.obsstore
+
         if tmpbundlefile:
             ui.note(_("adding branch\n"))
             f = vfs.open(tmpbundlefile, "rb")
--- a/tests/test-obsolete-bundle-strip.t	Thu Jun 01 12:08:49 2017 +0200
+++ b/tests/test-obsolete-bundle-strip.t	Sat May 20 16:19:59 2017 +0200
@@ -80,13 +80,25 @@
   >     if [ $orphan -eq 0 ];
   >     then
   >         printf "# stripping: "
+  >         prestripfile="${prefix}-pre-strip.txt"
+  >         poststripfile="${prefix}-post-strip.txt"
+  >         strippedfile="${prefix}-stripped-markers.txt"
+  >         hg debugobsolete --hidden | sort | sed 's/^/    /' > "${prestripfile}"
   >         hg strip --hidden --rev "${revs}"
+  >         hg debugobsolete --hidden | sort | sed 's/^/    /' > "${poststripfile}"
   >         hg debugbundle .hg/strip-backup/* | grep "obsmarkers --" -A 100 | sed 1,2d > "${stripcontentfile}"
   >         echo '### Backup markers ###'
   >         cat "${stripcontentfile}"
   >         echo '### diff <relevant> <backed-up> ###'
   >         cmp "${markersfile}" "${stripcontentfile}" || diff -u "${markersfile}" "${stripcontentfile}"
   >         echo '#################################'
+  >         cat "${prestripfile}" "${poststripfile}" | sort | uniq -u > "${strippedfile}"
+  >         echo '### Stripped markers ###'
+  >         cat "${strippedfile}"
+  >         echo '### diff <exclusive> <stripped> ###'
+  >         cmp "${exclufile}" "${strippedfile}" || diff -u "${exclufile}" "${strippedfile}"
+  >         echo '#################################'
+  >         # restore and clean up repo for the next test
   >         hg unbundle .hg/strip-backup/* | sed 's/^/# unbundling: /'
   >         # clean up directory for the next test
   >         rm .hg/strip-backup/*
@@ -150,6 +162,9 @@
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
@@ -180,10 +195,16 @@
       a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+      84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
   # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
+  # unbundling: 2 new obsolescence markers
   # unbundling: (run 'hg heads' to see heads)
 
   $ testrevs 'desc("C-A")'
@@ -212,10 +233,17 @@
       a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+      84fcb0dfe17b256ebae52e05572993b9194c018a a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a1 cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
   # unbundling: added 2 changesets with 2 changes to 2 files (+1 heads)
+  # unbundling: 3 new obsolescence markers
   # unbundling: (run 'hg heads' to see heads)
 
 chain with prune children
@@ -295,10 +323,15 @@
       29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+      29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
   # unbundling: added 1 changesets with 1 changes to 1 files
+  # unbundling: 1 new obsolescence markers
   # unbundling: (run 'hg update' to get a working copy)
 
   $ testrevs 'desc("C-A1")'
@@ -324,10 +357,15 @@
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+      84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
   # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
+  # unbundling: 1 new obsolescence markers
   # unbundling: (run 'hg heads' to see heads)
 
 bundling multiple revisions
@@ -378,10 +416,17 @@
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+      29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
   # unbundling: added 3 changesets with 3 changes to 3 files (+1 heads)
+  # unbundling: 3 new obsolescence markers
   # unbundling: (run 'hg heads' to see heads)
 
 chain with precursors also pruned
@@ -440,6 +485,9 @@
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
@@ -469,10 +517,15 @@
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+      84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
   # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
+  # unbundling: 1 new obsolescence markers
   # unbundling: (run 'hg heads' to see heads)
 
   $ testrevs 'desc("C-A")'
@@ -501,10 +554,17 @@
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+      84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
   # unbundling: added 2 changesets with 2 changes to 2 files (+1 heads)
+  # unbundling: 3 new obsolescence markers
   # unbundling: (run 'hg heads' to see heads)
 
 chain with missing prune
@@ -532,7 +592,7 @@
 
 (it is annoying to create prune with parent data without the changeset, so we strip it after the fact)
 
-  $ hg strip --hidden --rev 'desc("C-A0")::' --no-backup
+  $ hg strip --hidden --rev 'desc("C-A0")::' --no-backup --config devel.strip-obsmarkers=no
 
   $ hg up 'desc("ROOT")'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -574,10 +634,17 @@
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+      29f93b1df87baee1824e014080d8adf145f81783 0 {84fcb0dfe17b256ebae52e05572993b9194c018a} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
   # unbundling: added 1 changesets with 1 changes to 1 files
+  # unbundling: 3 new obsolescence markers
   # unbundling: (run 'hg update' to get a working copy)
 
 chain with precursors also pruned
@@ -603,7 +670,7 @@
 
 (it is annoying to create prune with parent data without the changeset, so we strip it after the fact)
 
-  $ hg strip --hidden --rev 'desc("C-A0")::' --no-backup
+  $ hg strip --hidden --rev 'desc("C-A0")::' --no-backup --config devel.strip-obsmarkers=no
 
   $ hg up 'desc("ROOT")'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -645,10 +712,17 @@
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+      84fcb0dfe17b256ebae52e05572993b9194c018a 0 {ea207398892eb49e06441f10dda2a731f0450f20} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      84fcb0dfe17b256ebae52e05572993b9194c018a cf2c22470d67233004e934a31184ac2b35389914 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 84fcb0dfe17b256ebae52e05572993b9194c018a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
   # unbundling: added 1 changesets with 1 changes to 1 files
+  # unbundling: 3 new obsolescence markers
   # unbundling: (run 'hg update' to get a working copy)
 
 Chain with fold and split
@@ -730,6 +804,9 @@
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
@@ -755,6 +832,9 @@
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
@@ -780,6 +860,9 @@
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
@@ -805,6 +888,9 @@
       a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
@@ -857,10 +943,20 @@
       c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+      06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
   # unbundling: added 1 changesets with 1 changes to 1 files (+1 heads)
+  # unbundling: 6 new obsolescence markers
   # unbundling: (run 'hg heads' to see heads)
 
 Bundle multiple revisions
@@ -1050,10 +1146,23 @@
       c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+      06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      27ec657ca21dd27c36c99fa75586f72ff0d442f1 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 06dc9da25ef03e1ff7864dded5fcba42eff2a3f0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      9ac430e15fca923b0ba027ca85d4d75c5c9cb73c a9b9da38ed96f8c6c14f429441f625a344eb4696 27ec657ca21dd27c36c99fa75586f72ff0d442f1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      9ac430e15fca923b0ba027ca85d4d75c5c9cb73c b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0 9ac430e15fca923b0ba027ca85d4d75c5c9cb73c 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      a9b9da38ed96f8c6c14f429441f625a344eb4696 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+      c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0 2f20ff6509f0e013e90c5c8efd996131c918b0ca 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
   # unbundling: added 5 changesets with 5 changes to 5 files (+4 heads)
+  # unbundling: 9 new obsolescence markers
   # unbundling: (run 'hg heads' to see heads)
 
 changeset pruned on its own
@@ -1117,10 +1226,15 @@
       cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+      cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
   # unbundling: added 1 changesets with 1 changes to 1 files
+  # unbundling: 1 new obsolescence markers
   # unbundling: (run 'hg update' to get a working copy)
   $ testrevs 'desc("C-")'
   ### Matched revisions###
@@ -1140,8 +1254,13 @@
       cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
   ### diff <relevant> <backed-up> ###
   #################################
+  ### Stripped markers ###
+      cefb651fc2fdc7bb75e588781de5e432c134e8a5 0 {9ac430e15fca923b0ba027ca85d4d75c5c9cb73c} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+  ### diff <exclusive> <stripped> ###
+  #################################
   # unbundling: adding changesets
   # unbundling: adding manifests
   # unbundling: adding file changes
   # unbundling: added 2 changesets with 2 changes to 2 files
+  # unbundling: 1 new obsolescence markers
   # unbundling: (run 'hg update' to get a working copy)
--- a/tests/test-obsolete.t	Thu Jun 01 12:08:49 2017 +0200
+++ b/tests/test-obsolete.t	Sat May 20 16:19:59 2017 +0200
@@ -1211,35 +1211,88 @@
   o  0:a78f55e5508c (draft) [ ] 0
   
 
+  $ hg strip --hidden -r 2 --config extensions.strip= --config devel.strip-obsmarkers=no
+  saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e008cf283490-39c978dc-backup.hg (glob)
+  $ hg debugobsolete
+  e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (*) {'user': 'test'} (glob)
+  f27abbcc1f77fb409cf9160482fe619541e2d605 0 {e008cf2834908e5d6b0f792a9d4b0e2272260fb8} (*) {'user': 'test'} (glob)
+  $ hg log -G
+  @  2:b0551702f918 (draft) [tip ] 2
+  |
+  o  1:e016b03fd86f (draft) [ ] 1
+  |
+  o  0:a78f55e5508c (draft) [ ] 0
+  
+  $ hg log -G --hidden
+  @  2:b0551702f918 (draft) [tip ] 2
+  |
+  o  1:e016b03fd86f (draft) [ ] 1
+  |
+  o  0:a78f55e5508c (draft) [ ] 0
+  
+  $ hg debugbundle .hg/strip-backup/e008cf283490-*-backup.hg
+  Stream params: sortdict([('Compression', 'BZ')])
+  changegroup -- "sortdict([('version', '02'), ('nbchanges', '2')])"
+      e008cf2834908e5d6b0f792a9d4b0e2272260fb8
+      f27abbcc1f77fb409cf9160482fe619541e2d605
+  obsmarkers -- 'sortdict()'
+      version: 1 (70 bytes)
+      f27abbcc1f77fb409cf9160482fe619541e2d605 0 {e008cf2834908e5d6b0f792a9d4b0e2272260fb8} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
+
+  $ hg pull .hg/strip-backup/e008cf283490-*-backup.hg
+  pulling from .hg/strip-backup/e008cf283490-39c978dc-backup.hg
+  searching for changes
+  no changes found
+  $ hg debugobsolete
+  e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (*) {'user': 'test'} (glob)
+  f27abbcc1f77fb409cf9160482fe619541e2d605 0 {e008cf2834908e5d6b0f792a9d4b0e2272260fb8} (*) {'user': 'test'} (glob)
+  $ hg log -G
+  @  2:b0551702f918 (draft) [tip ] 2
+  |
+  o  1:e016b03fd86f (draft) [ ] 1
+  |
+  o  0:a78f55e5508c (draft) [ ] 0
+  
+  $ hg log -G --hidden
+  @  2:b0551702f918 (draft) [tip ] 2
+  |
+  o  1:e016b03fd86f (draft) [ ] 1
+  |
+  o  0:a78f55e5508c (draft) [ ] 0
+  
+
+Testing that strip remove markers:
+
   $ hg strip -r 1 --config extensions.strip=
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e016b03fd86f-c41c6bcc-backup.hg (glob)
+  saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e016b03fd86f-65ede734-backup.hg (glob)
+  $ hg debugobsolete
   $ hg log -G
   @  0:a78f55e5508c (draft) [tip ] 0
   
   $ hg log -G --hidden
   @  0:a78f55e5508c (draft) [tip ] 0
   
-  $ hg debugbundle .hg/strip-backup/e016b03fd86f-c41c6bcc-backup.hg
+  $ hg debugbundle .hg/strip-backup/e016b03fd86f-*-backup.hg
   Stream params: sortdict([('Compression', 'BZ')])
-  changegroup -- "sortdict([('version', '02'), ('nbchanges', '4')])"
+  changegroup -- "sortdict([('version', '02'), ('nbchanges', '2')])"
       e016b03fd86fcccc54817d120b90b751aaf367d6
-      e008cf2834908e5d6b0f792a9d4b0e2272260fb8
-      f27abbcc1f77fb409cf9160482fe619541e2d605
       b0551702f918510f01ae838ab03a463054c67b46
   obsmarkers -- 'sortdict()'
       version: 1 (139 bytes)
       e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
       f27abbcc1f77fb409cf9160482fe619541e2d605 0 {e008cf2834908e5d6b0f792a9d4b0e2272260fb8} (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
 
-  $ hg pull .hg/strip-backup/*
-  pulling from .hg/strip-backup/e016b03fd86f-c41c6bcc-backup.hg
-  searching for changes
+  $ hg unbundle .hg/strip-backup/e016b03fd86f-*-backup.hg
   adding changesets
   adding manifests
   adding file changes
   added 2 changesets with 2 changes to 2 files
+  2 new obsolescence markers
   (run 'hg update' to get a working copy)
+  $ hg debugobsolete | sort
+  e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (*) {'user': 'test'} (glob)
+  f27abbcc1f77fb409cf9160482fe619541e2d605 0 {e008cf2834908e5d6b0f792a9d4b0e2272260fb8} (*) {'user': 'test'} (glob)
   $ hg log -G
   o  2:b0551702f918 (draft) [tip ] 2
   |
--- a/tests/test-subrepo-missing.t	Thu Jun 01 12:08:49 2017 +0200
+++ b/tests/test-subrepo-missing.t	Sat May 20 16:19:59 2017 +0200
@@ -108,7 +108,7 @@
 verify will warn if locked-in subrepo revisions are hidden or missing
 
   $ hg ci -m "amended subrepo (again)"
-  $ hg --config extensions.strip= --hidden strip -R subrepo -qr 'tip'
+  $ hg --config extensions.strip= --hidden strip -R subrepo -qr 'tip' --config devel.strip-obsmarkers=no
   $ hg verify
   checking changesets
   checking manifests
--- a/tests/testlib/exchange-obsmarker-util.sh	Thu Jun 01 12:08:49 2017 +0200
+++ b/tests/testlib/exchange-obsmarker-util.sh	Sat May 20 16:19:59 2017 +0200
@@ -32,6 +32,9 @@
 # we need to strip some changeset for some test cases
 hgext.strip=
 
+[devel]
+strip-obsmarkers = no
+
 [alias]
 # fix date used to create obsolete markers.
 debugobsolete=debugobsolete -d '0 0'