diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -597,18 +597,18 @@ class unpackermixin(object): if util.safehasattr(self._fp, 'close'): return self._fp.close() -def getunbundler(ui, fp, header=None): - """return a valid unbundler object for a given header""" - if header is None: - header = changegroup.readexactly(fp, 4) - magic, version = header[0:2], header[2:4] +def getunbundler(ui, fp, magicstring=None): + """return a valid unbundler object for a given magicstring""" + if magicstring is None: + magicstring = changegroup.readexactly(fp, 4) + magic, version = magicstring[0:2], magicstring[2:4] if magic != 'HG': raise util.Abort(_('not a Mercurial bundle')) unbundlerclass = formatmap.get(version) if unbundlerclass is None: raise util.Abort(_('unknown bundle version %s') % version) unbundler = unbundlerclass(ui, fp) - indebug(ui, 'start processing of %s stream' % header) + indebug(ui, 'start processing of %s stream' % magicstring) return unbundler class unbundle20(unpackermixin): diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -36,7 +36,7 @@ def readbundle(ui, fh, fname, vfs=None): alg = changegroup.readexactly(fh, 2) return changegroup.cg1unpacker(fh, alg) elif version.startswith('2'): - return bundle2.getunbundler(ui, fh, header=magic + version) + return bundle2.getunbundler(ui, fh, magicstring=magic + version) else: raise util.Abort(_('%s: unknown bundle version %s') % (fname, version))