changeset 27808:0c48c566bab0

with: use context manager for wlock in graft
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:46 -0800
parents 6ad5e134ef2e
children 37a75d69eb43
files mercurial/commands.py
diffstat 1 files changed, 1 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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)