Patchwork [1,of,7] strip: also backup obsmarkers

login
register
mail settings
Submitter Pierre-Yves David
Date June 1, 2017, 1:39 p.m.
Message ID <a9f5b20c68a41d7b2760.1496324384@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/21116/
State Accepted
Headers show

Comments

Pierre-Yves David - June 1, 2017, 1:39 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1495285570 -7200
#      Sat May 20 15:06:10 2017 +0200
# Node ID a9f5b20c68a41d7b2760e7f986c0968913d7c5bb
# Parent  5d44d7d4076e5a96001b0f88c730fa7ea24a9e02
# EXP-Topic obsstrip
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r a9f5b20c68a4
strip: also backup obsmarkers

We are about to give 'strip' the ability to remove obsmarkers. Before we start
removing data we must make sure it is preserved somewhere. So the backup bundle
created by 'strip' now contains obsmarkers.

Patch

diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -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}
+    contentopts = {'cg.version': cgversion, 'obsolescence': True}
     return bundle2.writenewbundle(repo.ui, repo, 'strip', name, bundletype,
                                   outgoing, contentopts, vfs, compression=comp)
 
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -1184,6 +1184,17 @@  Test ability to pull changeset with loca
   $ hg log -G --hidden
   @  0:a78f55e5508c (draft) [tip ] 0
   
+  $ hg debugbundle .hg/strip-backup/e016b03fd86f-c41c6bcc-backup.hg
+  Stream params: sortdict([('Compression', 'BZ')])
+  changegroup -- "sortdict([('version', '02'), ('nbchanges', '4')])"
+      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