--- a/mercurial/bundlerepo.py Thu Feb 05 16:03:26 2015 -0800
+++ b/mercurial/bundlerepo.py Fri Feb 06 11:27:25 2015 -0800
@@ -15,7 +15,7 @@
from i18n import _
import os, tempfile, shutil
import changegroup, util, mdiff, discovery, cmdutil, scmutil, exchange
-import localrepo, changelog, manifest, filelog, revlog, error, phases
+import localrepo, changelog, manifest, filelog, revlog, error, phases, bundle2
class bundlerevlog(revlog.revlog):
def __init__(self, opener, indexfile, bundle, linkmapper):
@@ -238,6 +238,24 @@
bundlename,
self.vfs)
+ if isinstance(self.bundle, bundle2.unbundle20):
+ cgparts = [part for part in self.bundle.iterparts()
+ if (part.type == 'b2x:changegroup')
+ and (part.params.get('version', '01')
+ in changegroup.packermap)]
+
+ if not cgparts:
+ raise util.Abort('No changegroups found')
+ version = cgparts[0].params.get('version', '01')
+ cgparts = [p for p in cgparts
+ if p.params.get('version', '01') == version]
+ if len(cgparts) > 1:
+ raise NotImplementedError("Can't process multiple changegroups")
+ part = cgparts[0]
+
+ part.seek(0)
+ self.bundle = changegroup.packermap[version][1](part, 'UN')
+
# dict with the mapping 'filename' -> position in the bundle
self.bundlefilespos = {}