Patchwork [4,of,5,STABLE] repair: use cg3 for treemanifests

login
register
mail settings
Submitter Martin von Zweigbergk
Date Jan. 20, 2016, 8:19 p.m.
Message ID <4cfcfdc7a0ca4d484e91.1453321153@waste.org>
Download mbox | patch
Permalink /patch/12849/
State Superseded
Commit 7cbb3a01fa38190d986741117a867a2e8586c668
Headers show

Comments

Martin von Zweigbergk - Jan. 20, 2016, 8:19 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1453246704 28800
#      Tue Jan 19 15:38:24 2016 -0800
# Branch stable
# Node ID 4cfcfdc7a0ca4d484e91b2a442aeef1ee3b82350
# Parent  6b0741a1cc768d53b2c6e7f0d12c639960eacba6
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.

Patch

diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -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)
diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t
--- a/tests/test-treemanifest.t
+++ b/tests/test-treemanifest.t
@@ -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 ..