Mercurial > hg-stable
changeset 38423:6bd9f18d31a8
progress: use context manager for lock
Differential Revision: https://phab.mercurial-scm.org/D3820
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 19 Jun 2018 22:06:28 -0700 |
parents | 35b50237908b |
children | b34d0a6ef936 |
files | mercurial/progress.py |
diffstat | 1 files changed, 1 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/progress.py Tue Jun 19 18:21:37 2018 +0200 +++ b/mercurial/progress.py Tue Jun 19 22:06:28 2018 -0700 @@ -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()