changeset 27806:a5eae47aa1f8

with: use context manager for wlock in debugrebuilddirstate
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:46 -0800
parents bdaf433192f0
children 6ad5e134ef2e
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
@@ -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):