Mercurial > public > mercurial-scm > hg
comparison mercurial/sparse.py @ 49960:c166b212bdee
dirstate: pass the repo to the `changeparent` method
If we want the context to be responsible for writing (and we want it), we need
to have access to a localrepository object.
So we now requires a localrepository object as an argument to this context
manager.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 25 Jan 2023 18:46:20 +0100 |
parents | 216f273b6b30 |
children | 7a8bfc05b691 |
comparison
equal
deleted
inserted
replaced
49959:376395868b7b | 49960:c166b212bdee |
---|---|
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(): | 454 with repo.dirstate.parentchange(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(): | 658 with repo.wlock(), repo.dirstate.parentchange(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(): | 674 with repo.wlock(), repo.dirstate.parentchange(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(): | 733 with repo.wlock(), repo.lock(), repo.dirstate.parentchange(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 |