comparison hgext/largefiles/lfutil.py @ 43584:a02e4c12ae60

largefiles: allow "lfstatus" context manager to set value to False Differential Revision: https://phab.mercurial-scm.org/D7140
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 18 Oct 2019 17:52:19 -0700
parents 73e6d3346e4f
children 2d49482d0dd4
comparison
equal deleted inserted replaced
43583:73e6d3346e4f 43584:a02e4c12ae60
39 39
40 # -- Private worker functions ------------------------------------------ 40 # -- Private worker functions ------------------------------------------
41 41
42 42
43 @contextlib.contextmanager 43 @contextlib.contextmanager
44 def lfstatus(repo): 44 def lfstatus(repo, value=True):
45 oldvalue = getattr(repo, 'lfstatus', False) 45 oldvalue = getattr(repo, 'lfstatus', False)
46 repo.lfstatus = True 46 repo.lfstatus = value
47 try: 47 try:
48 yield 48 yield
49 finally: 49 finally:
50 repo.lfstatus = oldvalue 50 repo.lfstatus = oldvalue
51 51
589 ) as progress: 589 ) as progress:
590 for i, n in enumerate(missing): 590 for i, n in enumerate(missing):
591 progress.update(i) 591 progress.update(i)
592 parents = [p for p in repo[n].parents() if p != node.nullid] 592 parents = [p for p in repo[n].parents() if p != node.nullid]
593 593
594 oldlfstatus = repo.lfstatus 594 with lfstatus(repo, value=False):
595 repo.lfstatus = False
596 try:
597 ctx = repo[n] 595 ctx = repo[n]
598 finally:
599 repo.lfstatus = oldlfstatus
600 596
601 files = set(ctx.files()) 597 files = set(ctx.files())
602 if len(parents) == 2: 598 if len(parents) == 2:
603 mc = ctx.manifest() 599 mc = ctx.manifest()
604 mp1 = ctx.p1().manifest() 600 mp1 = ctx.p1().manifest()