changeset 43631:a02e4c12ae60

largefiles: allow "lfstatus" context manager to set value to False Differential Revision: https://phab.mercurial-scm.org/D7140
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 18 Oct 2019 17:52:19 -0700
parents 73e6d3346e4f
children 99b881195abf
files hgext/largefiles/lfutil.py
diffstat 1 files changed, 3 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py	Fri Oct 18 17:46:37 2019 -0700
+++ b/hgext/largefiles/lfutil.py	Fri Oct 18 17:52:19 2019 -0700
@@ -41,9 +41,9 @@
 
 
 @contextlib.contextmanager
-def lfstatus(repo):
+def lfstatus(repo, value=True):
     oldvalue = getattr(repo, 'lfstatus', False)
-    repo.lfstatus = True
+    repo.lfstatus = value
     try:
         yield
     finally:
@@ -591,12 +591,8 @@
             progress.update(i)
             parents = [p for p in repo[n].parents() if p != node.nullid]
 
-            oldlfstatus = repo.lfstatus
-            repo.lfstatus = False
-            try:
+            with lfstatus(repo, value=False):
                 ctx = repo[n]
-            finally:
-                repo.lfstatus = oldlfstatus
 
             files = set(ctx.files())
             if len(parents) == 2: