with: use context manager for wlock in debugrebuilddirstate
authorBryan O'Sullivan <bryano@fb.com>
Fri, 15 Jan 2016 13:14:46 -0800
changeset 27806 a5eae47aa1f8
parent 27805 bdaf433192f0
child 27807 6ad5e134ef2e
with: use context manager for wlock in debugrebuilddirstate
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
@@ -3124,8 +3124,7 @@
     check the actual file content.
     """
     ctx = scmutil.revsingle(repo, rev)
-    wlock = repo.wlock()
-    try:
+    with repo.wlock():
         dirstate = repo.dirstate
         changedfiles = None
         # See command doc for what minimal does.
@@ -3138,8 +3137,6 @@
             changedfiles = manifestonly | dsnotadded
 
         dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
-    finally:
-        wlock.release()
 
 @command('debugrebuildfncache', [], '')
 def debugrebuildfncache(ui, repo):