mercurial/streamclone.py
changeset 33258 761ccfeff8b1
parent 33257 15e9cbe6ae49
child 33410 c784308305c6
equal deleted inserted replaced
33257:15e9cbe6ae49 33258:761ccfeff8b1
   211 
   211 
   212     repo.ui.debug('%d files, %d bytes to transfer\n' %
   212     repo.ui.debug('%d files, %d bytes to transfer\n' %
   213                   (len(entries), total_bytes))
   213                   (len(entries), total_bytes))
   214 
   214 
   215     svfs = repo.svfs
   215     svfs = repo.svfs
   216     oldaudit = svfs.mustaudit
       
   217     debugflag = repo.ui.debugflag
   216     debugflag = repo.ui.debugflag
   218     svfs.mustaudit = False
       
   219 
   217 
   220     def emitrevlogdata():
   218     def emitrevlogdata():
   221         try:
   219         for name, size in entries:
   222             for name, size in entries:
   220             if debugflag:
   223                 if debugflag:
   221                 repo.ui.debug('sending %s (%d bytes)\n' % (name, size))
   224                     repo.ui.debug('sending %s (%d bytes)\n' % (name, size))
   222             # partially encode name over the wire for backwards compat
   225                 # partially encode name over the wire for backwards compat
   223             yield '%s\0%d\n' % (store.encodedir(name), size)
   226                 yield '%s\0%d\n' % (store.encodedir(name), size)
   224             if size <= 65536:
   227                 if size <= 65536:
   225                 with svfs(name, 'rb', auditpath=False) as fp:
   228                     with svfs(name, 'rb', auditpath=False) as fp:
   226                     yield fp.read(size)
   229                         yield fp.read(size)
   227             else:
   230                 else:
   228                 data = svfs(name, auditpath=False)
   231                     data = svfs(name, auditpath=False)
   229                 for chunk in util.filechunkiter(data, limit=size):
   232                     for chunk in util.filechunkiter(data, limit=size):
   230                     yield chunk
   233                         yield chunk
       
   234         finally:
       
   235             svfs.mustaudit = oldaudit
       
   236 
   231 
   237     return len(entries), total_bytes, emitrevlogdata()
   232     return len(entries), total_bytes, emitrevlogdata()
   238 
   233 
   239 def generatev1wireproto(repo):
   234 def generatev1wireproto(repo):
   240     """Emit content for version 1 of streaming clone suitable for the wire.
   235     """Emit content for version 1 of streaming clone suitable for the wire.