# HG changeset patch # User Bryan O'Sullivan # Date 1452892486 28800 # Node ID 09820fb88e14b76f8e4cae52cd4dd4c01394cd47 # Parent 8c81975fe1450f48fffdfd69e200ea36416292f2 with: use context manager for wlock in workingctx.undelete diff -r 8c81975fe145 -r 09820fb88e14 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: