Show More
@@ -597,18 +597,18 b' class unpackermixin(object):' | |||||
597 | if util.safehasattr(self._fp, 'close'): |
|
597 | if util.safehasattr(self._fp, 'close'): | |
598 | return self._fp.close() |
|
598 | return self._fp.close() | |
599 |
|
599 | |||
600 |
def getunbundler(ui, fp, |
|
600 | def getunbundler(ui, fp, magicstring=None): | |
601 |
"""return a valid unbundler object for a given |
|
601 | """return a valid unbundler object for a given magicstring""" | |
602 |
if |
|
602 | if magicstring is None: | |
603 |
|
|
603 | magicstring = changegroup.readexactly(fp, 4) | |
604 |
magic, version = |
|
604 | magic, version = magicstring[0:2], magicstring[2:4] | |
605 | if magic != 'HG': |
|
605 | if magic != 'HG': | |
606 | raise util.Abort(_('not a Mercurial bundle')) |
|
606 | raise util.Abort(_('not a Mercurial bundle')) | |
607 | unbundlerclass = formatmap.get(version) |
|
607 | unbundlerclass = formatmap.get(version) | |
608 | if unbundlerclass is None: |
|
608 | if unbundlerclass is None: | |
609 | raise util.Abort(_('unknown bundle version %s') % version) |
|
609 | raise util.Abort(_('unknown bundle version %s') % version) | |
610 | unbundler = unbundlerclass(ui, fp) |
|
610 | unbundler = unbundlerclass(ui, fp) | |
611 |
indebug(ui, 'start processing of %s stream' % |
|
611 | indebug(ui, 'start processing of %s stream' % magicstring) | |
612 | return unbundler |
|
612 | return unbundler | |
613 |
|
613 | |||
614 | class unbundle20(unpackermixin): |
|
614 | class unbundle20(unpackermixin): |
@@ -36,7 +36,7 b' def readbundle(ui, fh, fname, vfs=None):' | |||||
36 | alg = changegroup.readexactly(fh, 2) |
|
36 | alg = changegroup.readexactly(fh, 2) | |
37 | return changegroup.cg1unpacker(fh, alg) |
|
37 | return changegroup.cg1unpacker(fh, alg) | |
38 | elif version.startswith('2'): |
|
38 | elif version.startswith('2'): | |
39 |
return bundle2.getunbundler(ui, fh, |
|
39 | return bundle2.getunbundler(ui, fh, magicstring=magic + version) | |
40 | else: |
|
40 | else: | |
41 | raise util.Abort(_('%s: unknown bundle version %s') % (fname, version)) |
|
41 | raise util.Abort(_('%s: unknown bundle version %s') % (fname, version)) | |
42 |
|
42 |
General Comments 0
You need to be logged in to leave comments.
Login now