# HG changeset patch # User Bryan O'Sullivan # Date 2016-01-15 21:14:49 # Node ID ed9950ba091eb7d45ae78baff809609a53b6258a # Parent 76ecf0227ea53b74b05e7bec1e18693dca8c3d07 with: use context manager for transaction in consumev1 diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py --- a/mercurial/streamclone.py +++ b/mercurial/streamclone.py @@ -297,8 +297,7 @@ def consumev1(repo, fp, filecount, bytec repo.ui.progress(_('clone'), 0, total=bytecount) start = time.time() - tr = repo.transaction('clone') - try: + with repo.transaction('clone'): for i in xrange(filecount): # XXX doesn't support '\n' or '\r' in filenames l = fp.readline() @@ -318,9 +317,6 @@ def consumev1(repo, fp, filecount, bytec repo.ui.progress(_('clone'), handled_bytes, total=bytecount) ofp.write(chunk) - tr.close() - finally: - tr.release() # Writing straight to files circumvented the inmemory caches repo.invalidate()