Patchwork [12,of,14,FIX-bundle2] bundlerepo: uncompress changegroup in bundle1 case only

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 20, 2015, 2:36 p.m.
Message ID <d313c8307c6b25c4df47.1445351788@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/11193/
State Accepted
Commit 73bf76bf6f145ba78670a4b994e715f61bc61a06
Headers show

Comments

Pierre-Yves David - Oct. 20, 2015, 2:36 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1445270648 -7200
#      Mon Oct 19 18:04:08 2015 +0200
# Node ID d313c8307c6b25c4df47125d6e1617ff968830ff
# Parent  5a5bdcfb1d79add813b938e97c82d8a76cb59736
# EXP-Topic generaldelta
# Available At http://hg.netv6.net/marmoute-wip/mercurial/
#              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r d313c8307c6b
bundlerepo: uncompress changegroup in bundle1 case only

Uncompressing bundle2 need to be handled differently.

Patch

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -273,15 +273,10 @@  class bundlerepository(localrepo.localre
             self._url = 'bundle:' + bundlename
 
         self.tempfile = None
         f = util.posixfile(bundlename, "rb")
         self.bundlefile = self.bundle = exchange.readbundle(ui, f, bundlename)
-        if self.bundle.compressed():
-            f = _writetempbundle(self.bundle.read, '.hg10un', header='HG10UN')
-            self.bundlefile = self.bundle = exchange.readbundle(ui, f,
-                                                                bundlename,
-                                                                self.vfs)
 
         if isinstance(self.bundle, bundle2.unbundle20):
             cgparts = [part for part in self.bundle.iterparts()
                        if (part.type == 'changegroup')
                        and (part.params.get('version', '01')
@@ -297,10 +292,16 @@  class bundlerepository(localrepo.localre
             part = cgparts[0]
 
             part.seek(0)
             self.bundle = changegroup.packermap[version][1](part, 'UN')
 
+        elif self.bundle.compressed():
+            f = _writetempbundle(self.bundle.read, '.hg10un', header='HG10UN')
+            self.bundlefile = self.bundle = exchange.readbundle(ui, f,
+                                                                bundlename,
+                                                                self.vfs)
+
         # dict with the mapping 'filename' -> position in the bundle
         self.bundlefilespos = {}
 
         self.firstnewrev = self.changelog.repotiprev + 1
         phases.retractboundary(self, None, phases.draft,