diff mercurial/repair.py @ 26423:c93f91c1db1c

strip: use bundle2 + cg2 by default when repository use general delta The bundle10 format (plain changegroup-01) does not support general delta and result into expensive delta re-computation when stripping. If the repository is general delta, we store backups as bundle20 containing a changegroup-02 payload. We remove the experimental feature related to strip backup bundle format because this achieve the same goal in a leaner way. Removing the experimental option is fine, that is why it experimental in the first place. Compression of these bundles are coming in later changesets.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 29 Sep 2015 13:16:51 -0700
parents a5f62af29517
children eb21b6679dc6
line wrap: on
line diff
--- a/mercurial/repair.py	Wed Sep 30 16:01:19 2015 -0400
+++ b/mercurial/repair.py	Tue Sep 29 13:16:51 2015 -0700
@@ -21,18 +21,9 @@
 
 def _bundle(repo, bases, heads, node, suffix, compress=True):
     """create a bundle with the specified revisions as a backup"""
-    usebundle2 = (repo.ui.configbool('experimental', 'bundle2-exp', True) and
-                  repo.ui.config('experimental', 'strip-bundle2-version'))
-    if usebundle2:
-        cgversion = repo.ui.config('experimental', 'strip-bundle2-version')
-        if cgversion not in changegroup.packermap:
-            repo.ui.warn(_('unknown strip-bundle2-version value %r; '
-                            'should be one of %r\n') %
-                         (cgversion, sorted(changegroup.packermap.keys()),))
-            cgversion = '01'
-            usebundle2 = False
-    else:
-        cgversion = '01'
+    cgversion = '01'
+    if 'generaldelta' in repo.requirements:
+        cgversion = '02'
 
     cg = changegroup.changegroupsubset(repo, bases, heads, 'strip',
                                        version=cgversion)
@@ -47,7 +38,7 @@
     totalhash = util.sha1(''.join(allhashes)).hexdigest()
     name = "%s/%s-%s-%s.hg" % (backupdir, short(node), totalhash[:8], suffix)
 
-    if usebundle2:
+    if cgversion != '01':
         bundletype = "HG20"
     elif compress:
         bundletype = "HG10BZ"