diff mercurial/scmutil.py @ 38380:800f5a2c869e

progress: make the progress helper a context manager This lets us simplify the use site in streamclone. Differential Revision: https://phab.mercurial-scm.org/D3775
author Martin von Zweigbergk <martinvonz@google.com>
date Sun, 17 Jun 2018 13:48:58 -0700
parents ef692614e601
children 6dea017eb6ba
line wrap: on
line diff
--- a/mercurial/scmutil.py	Sun Jun 17 22:13:41 2018 -0700
+++ b/mercurial/scmutil.py	Sun Jun 17 13:48:58 2018 -0700
@@ -1293,6 +1293,12 @@
         self.unit = unit
         self.total = total
 
+    def __enter__(self):
+        pass
+
+    def __exit__(self, exc_type, exc_value, exc_tb):
+        self.complete()
+
     def update(self, pos, item="", total=None):
         if total:
             self.total = total