Comments
Patch
@@ -89,11 +89,11 @@ def writebundle(cg, filename, bundletype
# in case of sshrepo because we don't know the end of the stream
# an empty chunkgroup is the end of the changegroup
# a changegroup has at least 2 chunkgroups (changelog and manifest).
# after that, an empty chunkgroup is the end of the changegroup
- for chunk in cg.getchunks():
+ for chunk in cg.getchunks(includeheader=False):
fh.write(z.compress(chunk))
fh.write(z.flush())
cleanup = None
return filename
finally:
@@ -185,20 +185,23 @@ class unbundle10(object):
delta = readexactly(self._stream, l - self.deltaheadersize)
node, p1, p2, deltabase, cs = self._deltaheader(header, prevnode)
return {'node': node, 'p1': p1, 'p2': p2, 'cs': cs,
'deltabase': deltabase, 'delta': delta}
- def getchunks(self):
+ def getchunks(self, includeheader=True):
"""returns all the chunks contains in the bundle
Used when you need to forward the binary stream to a file or another
network API. To do so, it parse the changegroup data, otherwise it will
block in case of sshrepo because it don't know the end of the stream.
"""
# an empty chunkgroup is the end of the changegroup
# a changegroup has at least 2 chunkgroups (changelog and manifest).
# after that, an empty chunkgroup is the end of the changegroup
+ if includeheader:
+ # do not use self._type as yielded chunk are not compressed
+ yield 'HG10UN'
empty = False
count = 0
while not empty or count <= 2:
empty = True
count += 1