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

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Oct 18 20:51:59 EDT 2019


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

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):



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


More information about the Mercurial-devel mailing list