Patchwork D7140: largefiles: allow "lfstatus" context manager to set value to False

login
register
mail settings
Submitter phabricator
Date Oct. 19, 2019, 7:38 a.m.
Message ID <differential-rev-PHID-DREV-gftzfwze6b2qzubwdttg-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42486/
State Superseded
Headers show

Comments

phabricator - Oct. 19, 2019, 7:38 a.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7140

AFFECTED FILES
  hgext/largefiles/lfutil.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -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: