changeset 27807:6ad5e134ef2e

with: use context manager for wlock in debugsetparents
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:46 -0800
parents a5eae47aa1f8
children 0c48c566bab0
files mercurial/commands.py
diffstat 1 files changed, 1 insertions(+), 4 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
@@ -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')),