mercurial/commands.py
changeset 27855 5b675a5665ef
parent 27854 55394c6fe74e
child 27856 2b3a21052be9
--- a/mercurial/commands.py	Fri Jan 15 13:14:49 2016 -0800
+++ b/mercurial/commands.py	Fri Jan 15 13:14:49 2016 -0800
@@ -6831,8 +6831,7 @@
     """
     fnames = (fname1,) + fnames
 
-    lock = repo.lock()
-    try:
+    with repo.lock():
         for fname in fnames:
             f = hg.openpath(ui, fname)
             gen = exchange.readbundle(ui, f, fname)
@@ -6861,8 +6860,6 @@
                         hint=_('use "hg debugapplystreamclonebundle"'))
             else:
                 modheads = gen.apply(repo, 'unbundle', 'bundle:' + fname)
-    finally:
-        lock.release()
 
     return postincoming(ui, repo, modheads, opts.get('update'), None)