[PATCH 3 of 4 STABLE] repair: use cg3 for treemanifests

Martin von Zweigbergk martinvonz at google.com
Wed Jan 20 22:42:45 CST 2016


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1453246704 28800
#      Tue Jan 19 15:38:24 2016 -0800
# Branch stable
# Node ID eaeaf246d84ef23131204cbc39e72b44ab923336
# Parent  446a832bc0e3ee893051ea5382b4a9d2a77009b3
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.

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 ..


More information about the Mercurial-devel mailing list