Patchwork D1376: bundlerepo: don't assume there are only two bundle classes

login
register
mail settings
Submitter phabricator
Date Nov. 13, 2017, 11:16 p.m.
Message ID <ee85f4c034ef1113ca11322d3c712238@localhost.localdomain>
Download mbox | patch
Permalink /patch/25536/
State Not Applicable
Headers show

Comments

phabricator - Nov. 13, 2017, 11:16 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4f04c9207a76: bundlerepo: don&#039;t assume there are only two bundle classes (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1376?vs=3431&id=3453

REVISION DETAIL
  https://phab.mercurial-scm.org/D1376

AFFECTED FILES
  mercurial/bundlerepo.py

CHANGE DETAILS




To: indygreg, #hg-reviewers, dlax, durin42
Cc: mercurial-devel

Patch

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -296,13 +296,16 @@ 
 
             if not hadchangegroup:
                 raise error.Abort(_("No changegroups found"))
-
-        elif self.bundle.compressed():
-            f = self._writetempbundle(self.bundle.read, '.hg10un',
-                                      header='HG10UN')
-            self.bundlefile = self.bundle = exchange.readbundle(ui, f,
-                                                                bundlepath,
-                                                                self.vfs)
+        elif isinstance(self.bundle, changegroup.cg1unpacker):
+            if self.bundle.compressed():
+                f = self._writetempbundle(self.bundle.read, '.hg10un',
+                                          header='HG10UN')
+                self.bundlefile = self.bundle = exchange.readbundle(ui, f,
+                                                                    bundlepath,
+                                                                    self.vfs)
+        else:
+            raise error.Abort(_('bundle type %s cannot be read') %
+                              type(self.bundle))
 
         # dict with the mapping 'filename' -> position in the bundle
         self.bundlefilespos = {}