##// END OF EJS Templates
with: use context manager for transaction in consumev1
Bryan O'Sullivan -
r27870:ed9950ba default
parent child Browse files
Show More
@@ -297,8 +297,7 b' def consumev1(repo, fp, filecount, bytec'
297 repo.ui.progress(_('clone'), 0, total=bytecount)
297 repo.ui.progress(_('clone'), 0, total=bytecount)
298 start = time.time()
298 start = time.time()
299
299
300 tr = repo.transaction('clone')
300 with repo.transaction('clone'):
301 try:
302 for i in xrange(filecount):
301 for i in xrange(filecount):
303 # XXX doesn't support '\n' or '\r' in filenames
302 # XXX doesn't support '\n' or '\r' in filenames
304 l = fp.readline()
303 l = fp.readline()
@@ -318,9 +317,6 b' def consumev1(repo, fp, filecount, bytec'
318 repo.ui.progress(_('clone'), handled_bytes,
317 repo.ui.progress(_('clone'), handled_bytes,
319 total=bytecount)
318 total=bytecount)
320 ofp.write(chunk)
319 ofp.write(chunk)
321 tr.close()
322 finally:
323 tr.release()
324
320
325 # Writing straight to files circumvented the inmemory caches
321 # Writing straight to files circumvented the inmemory caches
326 repo.invalidate()
322 repo.invalidate()
General Comments 0
You need to be logged in to leave comments. Login now