with: use context manager for wlock in graft
authorBryan O'Sullivan <bryano@fb.com>
Fri, 15 Jan 2016 13:14:46 -0800
changeset 27808 0c48c566bab0
parent 27807 6ad5e134ef2e
child 27809 37a75d69eb43
with: use context manager for wlock in graft
mercurial/commands.py
--- a/mercurial/commands.py	Fri Jan 15 13:14:46 2016 -0800
+++ b/mercurial/commands.py	Fri Jan 15 13:14:46 2016 -0800
@@ -3869,12 +3869,8 @@
 
     Returns 0 on successful completion.
     '''
-    wlock = None
-    try:
-        wlock = repo.wlock()
+    with repo.wlock():
         return _dograft(ui, repo, *revs, **opts)
-    finally:
-        release(wlock)
 
 def _dograft(ui, repo, *revs, **opts):
     revs = list(revs)