# HG changeset patch # User Bryan O'Sullivan # Date 2016-01-15 21:14:46 # Node ID 09820fb88e14b76f8e4cae52cd4dd4c01394cd47 # Parent 8c81975fe1450f48fffdfd69e200ea36416292f2 with: use context manager for wlock in workingctx.undelete diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1461,8 +1461,7 @@ class workingctx(committablectx): 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 @@ class workingctx(committablectx): t = fctx.data() self._repo.wwrite(f, t, fctx.flags()) self._repo.dirstate.normal(f) - finally: - wlock.release() def copy(self, source, dest): try: