changeset 27930:7cbb3a01fa38 stable

repair: use cg3 for treemanifests The newly created helper changegroup.safeversion() knows to pick version 03 if the repo uses treemanifests, so just using that means we pick the right changegroup version.
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 19 Jan 2016 15:38:24 -0800
parents 3b2ac2115464
children 1289a122cf3f
files mercurial/repair.py tests/test-treemanifest.t
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/repair.py	Tue Jan 19 15:32:32 2016 -0800
+++ b/mercurial/repair.py	Tue Jan 19 15:38:24 2016 -0800
@@ -22,9 +22,7 @@
 
 def _bundle(repo, bases, heads, node, suffix, compress=True):
     """create a bundle with the specified revisions as a backup"""
-    cgversion = '01'
-    if 'generaldelta' in repo.requirements:
-        cgversion = '02'
+    cgversion = changegroup.safeversion(repo)
 
     cg = changegroup.changegroupsubset(repo, bases, heads, 'strip',
                                        version=cgversion)
--- a/tests/test-treemanifest.t	Tue Jan 19 15:32:32 2016 -0800
+++ b/tests/test-treemanifest.t	Tue Jan 19 15:38:24 2016 -0800
@@ -285,6 +285,17 @@
        1       127     111      0       5 25ecb8cb8618 000000000000 000000000000
        2       238      55      1       6 5b16163a30c6 25ecb8cb8618 000000000000
 
+Stripping and recovering changes should work
+
+  $ hg st --change tip
+  M dir1/a
+  $ hg --config extensions.strip= strip tip
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  saved backup bundle to $TESTTMP/repo-mixed/.hg/strip-backup/51cfd7b1e13b-78a2f3ed-backup.hg (glob)
+  $ hg unbundle -q .hg/strip-backup/*
+  $ hg st --change tip
+  M dir1/a
+
 Create deeper repo with tree manifests.
 
   $ cd ..