mercurial/streamclone.py
changeset 27845 7417e1c10253
parent 27794 9a1f3f9bac5d
child 27850 49cfddbf54ba
--- a/mercurial/streamclone.py	Fri Jan 15 13:14:50 2016 -0800
+++ b/mercurial/streamclone.py	Fri Jan 15 13:14:50 2016 -0800
@@ -186,15 +186,12 @@
     entries = []
     total_bytes = 0
     # Get consistent snapshot of repo, lock during scan.
-    lock = repo.lock()
-    try:
+    with repo.lock():
         repo.ui.debug('scanning\n')
         for name, ename, size in _walkstreamfiles(repo):
             if size:
                 entries.append((name, size))
                 total_bytes += size
-    finally:
-            lock.release()
 
     repo.ui.debug('%d files, %d bytes to transfer\n' %
                   (len(entries), total_bytes))