mercurial/streamclone.py
changeset 33410 c784308305c6
parent 33258 761ccfeff8b1
child 33411 50b49bb0fff3
equal deleted inserted replaced
33409:50243c975fc2 33410:c784308305c6
   219         for name, size in entries:
   219         for name, size in entries:
   220             if debugflag:
   220             if debugflag:
   221                 repo.ui.debug('sending %s (%d bytes)\n' % (name, size))
   221                 repo.ui.debug('sending %s (%d bytes)\n' % (name, size))
   222             # partially encode name over the wire for backwards compat
   222             # partially encode name over the wire for backwards compat
   223             yield '%s\0%d\n' % (store.encodedir(name), size)
   223             yield '%s\0%d\n' % (store.encodedir(name), size)
   224             if size <= 65536:
   224             with svfs(name, 'rb', auditpath=False) as fp:
   225                 with svfs(name, 'rb', auditpath=False) as fp:
   225                 if size <= 65536:
   226                     yield fp.read(size)
   226                     yield fp.read(size)
   227             else:
   227                 else:
   228                 data = svfs(name, auditpath=False)
   228                     for chunk in util.filechunkiter(fp, limit=size):
   229                 for chunk in util.filechunkiter(data, limit=size):
   229                         yield chunk
   230                     yield chunk
       
   231 
   230 
   232     return len(entries), total_bytes, emitrevlogdata()
   231     return len(entries), total_bytes, emitrevlogdata()
   233 
   232 
   234 def generatev1wireproto(repo):
   233 def generatev1wireproto(repo):
   235     """Emit content for version 1 of streaming clone suitable for the wire.
   234     """Emit content for version 1 of streaming clone suitable for the wire.