Mercurial > public > mercurial-scm > hg
comparison hgext/phabricator.py @ 45485:b71858b42963
localrepo: load the share source .hg/hgrc also in share-safe mode (API)
The second part of the Share Safe Plan is to share source repo config also.
This patch adds logic to load the source repo .hg/hgrc if we are in share safe
mode. On unshare, we copy and prepend source config to current repo so that
config which was shared is persisted.
A test is added to show that now if we enable a hook on the source repo, that
also runs on the shared repositories.
API change as a new optional argument sharedvfs added to localrepo.loadhgrc()
Differential Revision: https://phab.mercurial-scm.org/D8656
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Thu, 02 Jul 2020 16:23:36 +0530 |
parents | 1a5d3e555c70 |
children | c7fe0dfb5312 |
comparison
equal
deleted
inserted
replaced
45484:63eb1b5c580d | 45485:b71858b42963 |
---|---|
165 ), | 165 ), |
166 ] | 166 ] |
167 | 167 |
168 | 168 |
169 @eh.wrapfunction(localrepo, "loadhgrc") | 169 @eh.wrapfunction(localrepo, "loadhgrc") |
170 def _loadhgrc(orig, ui, wdirvfs, hgvfs, requirements): | 170 def _loadhgrc(orig, ui, wdirvfs, hgvfs, requirements, **opts): |
171 """Load ``.arcconfig`` content into a ui instance on repository open. | 171 """Load ``.arcconfig`` content into a ui instance on repository open. |
172 """ | 172 """ |
173 result = False | 173 result = False |
174 arcconfig = {} | 174 arcconfig = {} |
175 | 175 |
199 cfg[(b"phabricator", b"url")] = arcconfig[b"phabricator.uri"] | 199 cfg[(b"phabricator", b"url")] = arcconfig[b"phabricator.uri"] |
200 | 200 |
201 if cfg: | 201 if cfg: |
202 ui.applyconfig(cfg, source=wdirvfs.join(b".arcconfig")) | 202 ui.applyconfig(cfg, source=wdirvfs.join(b".arcconfig")) |
203 | 203 |
204 return orig(ui, wdirvfs, hgvfs, requirements) or result # Load .hg/hgrc | 204 return ( |
205 orig(ui, wdirvfs, hgvfs, requirements, **opts) or result | |
206 ) # Load .hg/hgrc | |
205 | 207 |
206 | 208 |
207 def vcrcommand(name, flags, spec, helpcategory=None, optionalrepo=False): | 209 def vcrcommand(name, flags, spec, helpcategory=None, optionalrepo=False): |
208 fullflags = flags + _VCR_FLAGS | 210 fullflags = flags + _VCR_FLAGS |
209 | 211 |