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

login
register
mail settings
Submitter phabricator
Date Nov. 11, 2019, 12:34 p.m.
Message ID <b14fa93194562bb427915fc834c496ef@localhost.localdomain>
Download mbox | patch
Permalink /patch/43107/
State Not Applicable
Headers show

Comments

phabricator - Nov. 11, 2019, 12:34 p.m.
Closed by commit rHGa02e4c12ae60: largefiles: allow &quot;lfstatus&quot; context manager to set value to False (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7140?vs=17352&id=18005

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7140/new/

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

AFFECTED FILES
  hgext/largefiles/lfutil.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers, pulkit
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: