with: use context manager for wlock in workingctx.undelete
authorBryan O'Sullivan <bryano@fb.com>
Fri, 15 Jan 2016 13:14:46 -0800
changeset 27811 09820fb88e14
parent 27810 8c81975fe145
child 27812 28d0c0ef327b
with: use context manager for wlock in workingctx.undelete
mercurial/context.py
--- a/mercurial/context.py	Fri Jan 15 13:14:46 2016 -0800
+++ b/mercurial/context.py	Fri Jan 15 13:14:46 2016 -0800
@@ -1461,8 +1461,7 @@
 
     def undelete(self, list):
         pctxs = self.parents()
-        wlock = self._repo.wlock()
-        try:
+        with self._repo.wlock():
             for f in list:
                 if self._repo.dirstate[f] != 'r':
                     self._repo.ui.warn(_("%s not removed!\n") % f)
@@ -1471,8 +1470,6 @@
                     t = fctx.data()
                     self._repo.wwrite(f, t, fctx.flags())
                     self._repo.dirstate.normal(f)
-        finally:
-            wlock.release()
 
     def copy(self, source, dest):
         try: