comparison mercurial/sparse.py @ 47606:26bf0b9fe78f

sparse: clear rules in the context of a `parentchanges` context This is the same logic as the change we did for narrow. Differential Revision: https://phab.mercurial-scm.org/D11029
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 08 Jul 2021 19:06:32 +0200
parents a5701ffc10e4
children 7bdfd88251c0
comparison
equal deleted inserted replaced
47605:a5701ffc10e4 47606:26bf0b9fe78f
628 """Clears include/exclude rules from the sparse config. 628 """Clears include/exclude rules from the sparse config.
629 629
630 The remaining sparse config only has profiles, if defined. The working 630 The remaining sparse config only has profiles, if defined. The working
631 directory is refreshed, as needed. 631 directory is refreshed, as needed.
632 """ 632 """
633 with repo.wlock(): 633 with repo.wlock(), repo.dirstate.parentchange():
634 raw = repo.vfs.tryread(b'sparse') 634 raw = repo.vfs.tryread(b'sparse')
635 includes, excludes, profiles = parseconfig(repo.ui, raw, b'sparse') 635 includes, excludes, profiles = parseconfig(repo.ui, raw, b'sparse')
636 636
637 if not includes and not excludes: 637 if not includes and not excludes:
638 return 638 return
706 706
707 Only one of the actions may be performed. 707 Only one of the actions may be performed.
708 708
709 The new config is written out and a working directory refresh is performed. 709 The new config is written out and a working directory refresh is performed.
710 """ 710 """
711 with repo.wlock(): 711 with repo.wlock(), repo.dirstate.parentchange():
712 raw = repo.vfs.tryread(b'sparse') 712 raw = repo.vfs.tryread(b'sparse')
713 oldinclude, oldexclude, oldprofiles = parseconfig( 713 oldinclude, oldexclude, oldprofiles = parseconfig(
714 repo.ui, raw, b'sparse' 714 repo.ui, raw, b'sparse'
715 ) 715 )
716 716