with: use context manager for wlock in debugsetparents
authorBryan O'Sullivan <bryano@fb.com>
Fri, 15 Jan 2016 13:14:46 -0800
changeset 27807 6ad5e134ef2e
parent 27806 a5eae47aa1f8
child 27808 0c48c566bab0
with: use context manager for wlock in debugsetparents
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
@@ -3386,13 +3386,10 @@
     r1 = scmutil.revsingle(repo, rev1).node()
     r2 = scmutil.revsingle(repo, rev2, 'null').node()
 
-    wlock = repo.wlock()
-    try:
+    with repo.wlock():
         repo.dirstate.beginparentchange()
         repo.setparents(r1, r2)
         repo.dirstate.endparentchange()
-    finally:
-        wlock.release()
 
 @command('debugdirstate|debugstate',
     [('', 'nodates', None, _('do not display the saved mtime')),