##// END OF EJS Templates
streamclone: use context manager for writing files...
Gregory Szorc -
r27707:14f5ea7c default
parent child Browse files
Show More
@@ -319,12 +319,12 b' def consumev1(repo, fp, filecount, bytec'
319 repo.ui.debug('adding %s (%s)\n' %
319 repo.ui.debug('adding %s (%s)\n' %
320 (name, util.bytecount(size)))
320 (name, util.bytecount(size)))
321 # for backwards compat, name was partially encoded
321 # for backwards compat, name was partially encoded
322 ofp = repo.svfs(store.decodedir(name), 'w')
322 with repo.svfs(store.decodedir(name), 'w') as ofp:
323 for chunk in util.filechunkiter(fp, limit=size):
323 for chunk in util.filechunkiter(fp, limit=size):
324 handled_bytes += len(chunk)
324 handled_bytes += len(chunk)
325 repo.ui.progress(_('clone'), handled_bytes, total=bytecount)
325 repo.ui.progress(_('clone'), handled_bytes,
326 ofp.write(chunk)
326 total=bytecount)
327 ofp.close()
327 ofp.write(chunk)
328 tr.close()
328 tr.close()
329 finally:
329 finally:
330 tr.release()
330 tr.release()
General Comments 0
You need to be logged in to leave comments. Login now