comparison mercurial/sparse.py @ 45355:a1f51c7dce0f

repository: introduce constant for sparse repo requirement and use it In future we will like to much cleaner logic around which requirement is for working copy and which can go in store. To start with that, we first need to de-clutter the requirement values spread around and replace them with constants. Differential Revision: https://phab.mercurial-scm.org/D8911
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 08 Aug 2020 10:06:32 -0700
parents 3c783ff08d40
children 77b8588dd84e
comparison
equal deleted inserted replaced
45354:c4fe2262435e 45355:a1f51c7dce0f
22 pathutil, 22 pathutil,
23 pycompat, 23 pycompat,
24 scmutil, 24 scmutil,
25 util, 25 util,
26 ) 26 )
27 from .interfaces import repository
27 from .utils import hashutil 28 from .utils import hashutil
29
28 30
29 # Whether sparse features are enabled. This variable is intended to be 31 # Whether sparse features are enabled. This variable is intended to be
30 # temporary to facilitate porting sparse to core. It should eventually be 32 # temporary to facilitate porting sparse to core. It should eventually be
31 # a per-repo option, possibly a repo requirement. 33 # a per-repo option, possibly a repo requirement.
32 enabled = False 34 enabled = False
604 # re-read. We ideally want to update the cached matcher on the 606 # re-read. We ideally want to update the cached matcher on the
605 # repo instance then flush the new config to disk once wdir is 607 # repo instance then flush the new config to disk once wdir is
606 # updated. But this requires massive rework to matcher() and its 608 # updated. But this requires massive rework to matcher() and its
607 # consumers. 609 # consumers.
608 610
609 if b'exp-sparse' in oldrequires and removing: 611 if repository.SPARSE_REQUIREMENT in oldrequires and removing:
610 repo.requirements.discard(b'exp-sparse') 612 repo.requirements.discard(repository.SPARSE_REQUIREMENT)
611 scmutil.writereporequirements(repo) 613 scmutil.writereporequirements(repo)
612 elif b'exp-sparse' not in oldrequires: 614 elif repository.SPARSE_REQUIREMENT not in oldrequires:
613 repo.requirements.add(b'exp-sparse') 615 repo.requirements.add(repository.SPARSE_REQUIREMENT)
614 scmutil.writereporequirements(repo) 616 scmutil.writereporequirements(repo)
615 617
616 try: 618 try:
617 writeconfig(repo, includes, excludes, profiles) 619 writeconfig(repo, includes, excludes, profiles)
618 return refreshwdir(repo, oldstatus, oldmatch, force=force) 620 return refreshwdir(repo, oldstatus, oldmatch, force=force)