Show More
@@ -2139,6 +2139,7 b' def _docommit(ui, repo, *pats, **opts):' | |||
|
2139 | 2139 | None, |
|
2140 | 2140 | _(b'edit shared source repository config (EXPERIMENTAL)'), |
|
2141 | 2141 | ), |
|
2142 | (b'', b'non-shared', None, _(b'edit non shared config (EXPERIMENTAL)')), | |
|
2142 | 2143 | (b'g', b'global', None, _(b'edit global config')), |
|
2143 | 2144 | ] |
|
2144 | 2145 | + formatteropts, |
@@ -2169,6 +2170,9 b' def config(ui, repo, *values, **opts):' | |||
|
2169 | 2170 | |
|
2170 | 2171 | .. container:: verbose |
|
2171 | 2172 | |
|
2173 | --non-shared flag is used to edit `.hg/hgrc-not-shared` config file. | |
|
2174 | This file is not shared across shares when in share-safe mode. | |
|
2175 | ||
|
2172 | 2176 | Template: |
|
2173 | 2177 | |
|
2174 | 2178 | The following keywords are supported. See also :hg:`help templates`. |
@@ -2186,7 +2190,7 b' def config(ui, repo, *values, **opts):' | |||
|
2186 | 2190 | """ |
|
2187 | 2191 | |
|
2188 | 2192 | opts = pycompat.byteskwargs(opts) |
|
2189 | editopts = (b'edit', b'local', b'global', b'shared') | |
|
2193 | editopts = (b'edit', b'local', b'global', b'shared', b'non_shared') | |
|
2190 | 2194 | if any(opts.get(o) for o in editopts): |
|
2191 | 2195 | cmdutil.check_at_most_one_arg(opts, *editopts[1:]) |
|
2192 | 2196 | if opts.get(b'local'): |
@@ -2208,6 +2212,8 b' def config(ui, repo, *values, **opts):' | |||
|
2208 | 2212 | ) |
|
2209 | 2213 | ) |
|
2210 | 2214 | paths = [vfsmod.vfs(repo.sharedpath).join(b'hgrc')] |
|
2215 | elif opts.get(b'non_shared'): | |
|
2216 | paths = [repo.vfs.join(b'hgrc-not-shared')] | |
|
2211 | 2217 | else: |
|
2212 | 2218 | paths = rcutil.userrcpath() |
|
2213 | 2219 |
@@ -987,6 +987,7 b' def _getlocal(ui, rpath, wd=None):' | |||
|
987 | 987 | if rcutil.use_repo_hgrc(): |
|
988 | 988 | _readsharedsourceconfig(lui, path) |
|
989 | 989 | lui.readconfig(os.path.join(path, b".hg", b"hgrc"), path) |
|
990 | lui.readconfig(os.path.join(path, b".hg", b"hgrc-not-shared"), path) | |
|
990 | 991 | |
|
991 | 992 | if rpath: |
|
992 | 993 | path = lui.expandpath(rpath) |
@@ -994,6 +995,7 b' def _getlocal(ui, rpath, wd=None):' | |||
|
994 | 995 | if rcutil.use_repo_hgrc(): |
|
995 | 996 | _readsharedsourceconfig(lui, path) |
|
996 | 997 | lui.readconfig(os.path.join(path, b".hg", b"hgrc"), path) |
|
998 | lui.readconfig(os.path.join(path, b".hg", b"hgrc-not-shared"), path) | |
|
997 | 999 | |
|
998 | 1000 | return path, lui |
|
999 | 1001 |
@@ -715,18 +715,28 b' def loadhgrc(ui, wdirvfs, hgvfs, require' | |||
|
715 | 715 | if not rcutil.use_repo_hgrc(): |
|
716 | 716 | return False |
|
717 | 717 | |
|
718 | ret = False | |
|
718 | 719 | # first load config from shared source if we has to |
|
719 | 720 | if requirementsmod.SHARESAFE_REQUIREMENT in requirements and sharedvfs: |
|
720 | 721 | try: |
|
721 | 722 | ui.readconfig(sharedvfs.join(b'hgrc'), root=sharedvfs.base) |
|
723 | ret = True | |
|
722 | 724 | except IOError: |
|
723 | 725 | pass |
|
724 | 726 | |
|
725 | 727 | try: |
|
726 | 728 | ui.readconfig(hgvfs.join(b'hgrc'), root=wdirvfs.base) |
|
727 |
ret |
|
|
729 | ret = True | |
|
728 | 730 | except IOError: |
|
729 |
|
|
|
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 | 742 | def afterhgrcload(ui, wdirvfs, hgvfs, requirements): |
@@ -259,7 +259,7 b' Show all commands + options' | |||
|
259 | 259 | cat: output, rev, decode, include, exclude, template |
|
260 | 260 | clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure |
|
261 | 261 | commit: addremove, close-branch, amend, secret, edit, force-close-branch, interactive, include, exclude, message, logfile, date, user, subrepos |
|
262 | config: untrusted, edit, local, shared, global, template | |
|
262 | config: untrusted, edit, local, shared, non-shared, global, template | |
|
263 | 263 | continue: dry-run |
|
264 | 264 | copy: forget, after, at-rev, force, include, exclude, dry-run |
|
265 | 265 | debugancestor: |
@@ -253,6 +253,25 b' Shared one should work' | |||
|
253 | 253 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
254 | 254 | summary: added c |
|
255 | 255 | |
|
256 | ||
|
257 | Testing that nonsharedrc is loaded for source and not shared | |
|
258 | ||
|
259 | $ cd ../source | |
|
260 | $ touch .hg/hgrc-not-shared | |
|
261 | $ echo "[ui]" >> .hg/hgrc-not-shared | |
|
262 | $ echo "traceback=true" >> .hg/hgrc-not-shared | |
|
263 | ||
|
264 | $ hg showconfig ui.traceback | |
|
265 | true | |
|
266 | ||
|
267 | $ HGEDITOR=cat hg config --non-shared | |
|
268 | [ui] | |
|
269 | traceback=true | |
|
270 | ||
|
271 | $ cd ../shared1 | |
|
272 | $ hg showconfig ui.traceback | |
|
273 | [1] | |
|
274 | ||
|
256 | 275 | Unsharing works |
|
257 | 276 | |
|
258 | 277 | $ hg unshare |
General Comments 0
You need to be logged in to leave comments.
Login now