comparison mercurial/sparse.py @ 49961:7a8bfc05b691

dirstate: rename parentchange to changing_parents Since the new argument breaks the API anyway, we can rename it to a better name. The previous name `parentchange` might be seen as something active, a function that would directly change the parents, however this is just a context manager to frame the operation that will change the parents and adjust the dirstate content accordingly. In addition, the future sister method that will be about changes to tracking and files would have a hard time fitting in the same naming scheme in a clear way. The new naming uses a clear prefix will make it more distinct from other dirstate methods and easier to extend with other similar contexts.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 25 Jan 2023 19:12:31 +0100
parents c166b212bdee
children 0d7ccb163b4f
comparison
equal deleted inserted replaced
49960:c166b212bdee 49961:7a8bfc05b691
449 mergestatemod.ACTION_GET, 449 mergestatemod.ACTION_GET,
450 (fctx.flags(), False), 450 (fctx.flags(), False),
451 message, 451 message,
452 ) 452 )
453 453
454 with repo.dirstate.parentchange(repo): 454 with repo.dirstate.changing_parents(repo):
455 mergemod.applyupdates( 455 mergemod.applyupdates(
456 repo, 456 repo,
457 tmresult, 457 tmresult,
458 repo[None], 458 repo[None],
459 repo[b'.'], 459 repo[b'.'],
653 """Clears include/exclude rules from the sparse config. 653 """Clears include/exclude rules from the sparse config.
654 654
655 The remaining sparse config only has profiles, if defined. The working 655 The remaining sparse config only has profiles, if defined. The working
656 directory is refreshed, as needed. 656 directory is refreshed, as needed.
657 """ 657 """
658 with repo.wlock(), repo.dirstate.parentchange(repo): 658 with repo.wlock(), repo.dirstate.changing_parents(repo):
659 raw = repo.vfs.tryread(b'sparse') 659 raw = repo.vfs.tryread(b'sparse')
660 includes, excludes, profiles = parseconfig(repo.ui, raw, b'sparse') 660 includes, excludes, profiles = parseconfig(repo.ui, raw, b'sparse')
661 661
662 if not includes and not excludes: 662 if not includes and not excludes:
663 return 663 return
669 """Import sparse config rules from files. 669 """Import sparse config rules from files.
670 670
671 The updated sparse config is written out and the working directory 671 The updated sparse config is written out and the working directory
672 is refreshed, as needed. 672 is refreshed, as needed.
673 """ 673 """
674 with repo.wlock(), repo.dirstate.parentchange(repo): 674 with repo.wlock(), repo.dirstate.changing_parents(repo):
675 # read current configuration 675 # read current configuration
676 raw = repo.vfs.tryread(b'sparse') 676 raw = repo.vfs.tryread(b'sparse')
677 includes, excludes, profiles = parseconfig(repo.ui, raw, b'sparse') 677 includes, excludes, profiles = parseconfig(repo.ui, raw, b'sparse')
678 aincludes, aexcludes, aprofiles = activeconfig(repo) 678 aincludes, aexcludes, aprofiles = activeconfig(repo)
679 679
728 ): 728 ):
729 """Perform a sparse config update. 729 """Perform a sparse config update.
730 730
731 The new config is written out and a working directory refresh is performed. 731 The new config is written out and a working directory refresh is performed.
732 """ 732 """
733 with repo.wlock(), repo.lock(), repo.dirstate.parentchange(repo): 733 with repo.wlock(), repo.lock(), repo.dirstate.changing_parents(repo):
734 raw = repo.vfs.tryread(b'sparse') 734 raw = repo.vfs.tryread(b'sparse')
735 oldinclude, oldexclude, oldprofiles = parseconfig( 735 oldinclude, oldexclude, oldprofiles = parseconfig(
736 repo.ui, raw, b'sparse' 736 repo.ui, raw, b'sparse'
737 ) 737 )
738 738