changeset 27811:09820fb88e14

with: use context manager for wlock in workingctx.undelete
author Bryan O'Sullivan <bryano@fb.com>
date Fri, 15 Jan 2016 13:14:46 -0800
parents 8c81975fe145
children 28d0c0ef327b
files mercurial/context.py
diffstat 1 files changed, 1 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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: