Mercurial > hg
comparison mercurial/localrepo.py @ 45783:88a47cbf063c
config: add a .hg/hgrc-not-shared which won't be shared in share-safe mode
Previous patches add a safe mode for sharing repositories which involve sharing
of source requirements and config files.
In certain situations we might need to add a config to source repository which
we does not want to share. For this, we add a `.hg/hgrc-not-shared` which won't
be shared.
This also adds a `--non-shared` flag to `hg config` command to see the
non-shared config.
Differential Revision: https://phab.mercurial-scm.org/D8673
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 01 Jul 2020 15:14:59 +0530 |
parents | 9b16bb3b2349 |
children | 80f32ec8653a |
comparison
equal
deleted
inserted
replaced
45782:fd1de908f2b4 | 45783:88a47cbf063c |
---|---|
713 shared one | 713 shared one |
714 """ | 714 """ |
715 if not rcutil.use_repo_hgrc(): | 715 if not rcutil.use_repo_hgrc(): |
716 return False | 716 return False |
717 | 717 |
718 ret = False | |
718 # first load config from shared source if we has to | 719 # first load config from shared source if we has to |
719 if requirementsmod.SHARESAFE_REQUIREMENT in requirements and sharedvfs: | 720 if requirementsmod.SHARESAFE_REQUIREMENT in requirements and sharedvfs: |
720 try: | 721 try: |
721 ui.readconfig(sharedvfs.join(b'hgrc'), root=sharedvfs.base) | 722 ui.readconfig(sharedvfs.join(b'hgrc'), root=sharedvfs.base) |
723 ret = True | |
722 except IOError: | 724 except IOError: |
723 pass | 725 pass |
724 | 726 |
725 try: | 727 try: |
726 ui.readconfig(hgvfs.join(b'hgrc'), root=wdirvfs.base) | 728 ui.readconfig(hgvfs.join(b'hgrc'), root=wdirvfs.base) |
727 return True | 729 ret = True |
728 except IOError: | 730 except IOError: |
729 return False | 731 pass |
732 | |
733 try: | |
734 ui.readconfig(hgvfs.join(b'hgrc-not-shared'), root=wdirvfs.base) | |
735 ret = True | |
736 except IOError: | |
737 pass | |
738 | |
739 return ret | |
730 | 740 |
731 | 741 |
732 def afterhgrcload(ui, wdirvfs, hgvfs, requirements): | 742 def afterhgrcload(ui, wdirvfs, hgvfs, requirements): |
733 """Perform additional actions after .hg/hgrc is loaded. | 743 """Perform additional actions after .hg/hgrc is loaded. |
734 | 744 |