# HG changeset patch # User Matt Mackall # Date 2010-08-25 21:53:06 # Node ID bef5effb3db0cc5b1366bc9c793e89a26a743125 # Parent 210049a8d16e25e6fe56bd8940b41eed9e38743c bundle: introduce bundle class diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -138,6 +138,12 @@ def decompressor(fh, alg): raise util.Abort("unknown bundle compression '%s'" % alg) return generator(fh) +class unbundle10(object): + def __init__(self, fh, alg): + self._stream = util.chunkbuffer(decompressor(fh, alg)) + def read(self, l): + return self._stream.read(l) + def readbundle(fh, fname): header = fh.read(6) @@ -158,4 +164,4 @@ def readbundle(fh, fname): raise util.Abort(_('%s: not a Mercurial bundle') % fname) if version != '10': raise util.Abort(_('%s: unknown bundle version %s') % (fname, version)) - return util.chunkbuffer(decompressor(fh, alg)) + return unbundle10(fh, alg)