comparison mercurial/sparse.py @ 45106:a03c177a4679

scmutil: add writereporequirements() and route requires writing through it In upcoming patches, to implement Share Safe plan we will be introducing requires file in store. We need to route all callers to a single function to check for a share-safe requirement and if present, write requirements to .hg/store/requires instead. After this patch, callers directly calling scmutil.writerequires() are only those where we don't have the repo object, for example when initializing the repository object itself. Differential Revision: https://phab.mercurial-scm.org/D8631
author Pulkit Goyal <7895pulkit@gmail.com>
date Tue, 14 Apr 2020 16:43:54 +0530
parents b7808443ed6a
children d70c972cec74
comparison
equal deleted inserted replaced
45105:5d09a120b4be 45106:a03c177a4679
599 # updated. But this requires massive rework to matcher() and its 599 # updated. But this requires massive rework to matcher() and its
600 # consumers. 600 # consumers.
601 601
602 if b'exp-sparse' in oldrequires and removing: 602 if b'exp-sparse' in oldrequires and removing:
603 repo.requirements.discard(b'exp-sparse') 603 repo.requirements.discard(b'exp-sparse')
604 scmutil.writerequires(repo.vfs, repo.requirements) 604 scmutil.writereporequirements(repo)
605 elif b'exp-sparse' not in oldrequires: 605 elif b'exp-sparse' not in oldrequires:
606 repo.requirements.add(b'exp-sparse') 606 repo.requirements.add(b'exp-sparse')
607 scmutil.writerequires(repo.vfs, repo.requirements) 607 scmutil.writereporequirements(repo)
608 608
609 try: 609 try:
610 writeconfig(repo, includes, excludes, profiles) 610 writeconfig(repo, includes, excludes, profiles)
611 return refreshwdir(repo, oldstatus, oldmatch, force=force) 611 return refreshwdir(repo, oldstatus, oldmatch, force=force)
612 except Exception: 612 except Exception:
613 if repo.requirements != oldrequires: 613 if repo.requirements != oldrequires:
614 repo.requirements.clear() 614 repo.requirements.clear()
615 repo.requirements |= oldrequires 615 repo.requirements |= oldrequires
616 scmutil.writerequires(repo.vfs, repo.requirements) 616 scmutil.writereporequirements(repo)
617 writeconfig(repo, oldincludes, oldexcludes, oldprofiles) 617 writeconfig(repo, oldincludes, oldexcludes, oldprofiles)
618 raise 618 raise
619 619
620 620
621 def clearrules(repo, force=False): 621 def clearrules(repo, force=False):