progress: use context manager for lock
Differential Revision: https://phab.mercurial-scm.org/D3820
--- 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()