changeset 12043:bef5effb3db0

bundle: introduce bundle class
author Matt Mackall <mpm@selenic.com>
date Wed, 25 Aug 2010 16:53:06 -0500
parents 210049a8d16e
children bcc7139521b7
files mercurial/changegroup.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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)