From patchwork Sat Oct 19 07:38:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D7140: largefiles: allow "lfstatus" context manager to set value to False From: phabricator X-Patchwork-Id: 42486 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Sat, 19 Oct 2019 07:38:18 +0000 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 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: