Patchwork D7137: largefiles: reset "lfstatus" attribute to previous value in "finally"

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

Comments

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

REVISION SUMMARY
  We were resetting it to False, which means nesting of these overrides
  would be incorrect.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/largefiles/overrides.py

CHANGE DETAILS




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

Patch

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -160,11 +160,12 @@ 
 
 @contextlib.contextmanager
 def lfstatus(repo):
+    oldvalue = getattr(repo, 'lfstatus', False)
     repo.lfstatus = True
     try:
         yield
     finally:
-        repo.lfstatus = False
+        repo.lfstatus = oldvalue
 
 
 def removelargefiles(ui, repo, isaddremove, matcher, uipathfn, dryrun, **opts):