diff --git a/mercurial/progress.py b/mercurial/progress.py --- a/mercurial/progress.py +++ b/mercurial/progress.py @@ -265,8 +265,7 @@ def progress(self, topic, pos, item='', unit='', total=None): now = time.time() - self._refreshlock.acquire() - try: + with self._refreshlock: if pos is None: self.starttimes.pop(topic, None) self.startvals.pop(topic, None) @@ -298,5 +297,3 @@ if self._oktoprint(now): self.lastprint = now self.show(now, topic, *self.topicstates[topic]) - finally: - self._refreshlock.release()