##// END OF EJS Templates
bundle2.getunbundler: rename "header" to "magicstring"...
Pierre-Yves David -
r25640:39f0064a default
parent child Browse files
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, header=None):
600 def getunbundler(ui, fp, magicstring=None):
601 """return a valid unbundler object for a given header"""
601 """return a valid unbundler object for a given magicstring"""
602 if header is None:
602 if magicstring is None:
603 header = changegroup.readexactly(fp, 4)
603 magicstring = changegroup.readexactly(fp, 4)
604 magic, version = header[0:2], header[2:4]
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' % header)
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, header=magic + version)
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