bundle: introduce bundle class
authorMatt Mackall <mpm@selenic.com>
Wed, 25 Aug 2010 16:53:06 -0500
changeset 12043 bef5effb3db0
parent 12042 210049a8d16e
child 12044 bcc7139521b7
bundle: introduce bundle class
mercurial/changegroup.py
--- a/mercurial/changegroup.py	Wed Aug 25 15:33:06 2010 -0500
+++ b/mercurial/changegroup.py	Wed Aug 25 16:53:06 2010 -0500
@@ -138,6 +138,12 @@
         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 @@
         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)