hgext/transplant.py
changeset 27840 dc237afacbd4
parent 27678 b97004648028
child 28394 dcb4209bd30d
--- a/hgext/transplant.py	Fri Jan 15 13:14:47 2016 -0800
+++ b/hgext/transplant.py	Fri Jan 15 13:14:47 2016 -0800
@@ -20,7 +20,6 @@
 from mercurial import bundlerepo, hg, merge, match
 from mercurial import patch, revlog, scmutil, util, error, cmdutil
 from mercurial import revset, templatekw, exchange
-from mercurial import lock as lockmod
 
 class TransplantError(error.Abort):
     pass
@@ -575,12 +574,8 @@
     and then resume where you left off by calling :hg:`transplant
     --continue/-c`.
     '''
-    wlock = None
-    try:
-        wlock = repo.wlock()
+    with repo.wlock():
         return _dotransplant(ui, repo, *revs, **opts)
-    finally:
-        lockmod.release(wlock)
 
 def _dotransplant(ui, repo, *revs, **opts):
     def incwalk(repo, csets, match=util.always):