# HG changeset patch # User Bryan O'Sullivan # Date 2016-01-15 21:14:46 # Node ID 8c81975fe1450f48fffdfd69e200ea36416292f2 # Parent 37a75d69eb43d21df6b85bdd073ec66b606bf84d with: use context manager for wlock in workingctx.forget diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1447,8 +1447,7 @@ class workingctx(committablectx): def forget(self, files, prefix=""): join = lambda f: os.path.join(prefix, f) - wlock = self._repo.wlock() - try: + with self._repo.wlock(): rejected = [] for f in files: if f not in self._repo.dirstate: @@ -1459,8 +1458,6 @@ class workingctx(committablectx): else: self._repo.dirstate.drop(f) return rejected - finally: - wlock.release() def undelete(self, list): pctxs = self.parents()