Show More
@@ -2139,6 +2139,7 b' def _docommit(ui, repo, *pats, **opts):' | |||||
2139 | None, |
|
2139 | None, | |
2140 | _(b'edit shared source repository config (EXPERIMENTAL)'), |
|
2140 | _(b'edit shared source repository config (EXPERIMENTAL)'), | |
2141 | ), |
|
2141 | ), | |
|
2142 | (b'', b'non-shared', None, _(b'edit non shared config (EXPERIMENTAL)')), | |||
2142 | (b'g', b'global', None, _(b'edit global config')), |
|
2143 | (b'g', b'global', None, _(b'edit global config')), | |
2143 | ] |
|
2144 | ] | |
2144 | + formatteropts, |
|
2145 | + formatteropts, | |
@@ -2169,6 +2170,9 b' def config(ui, repo, *values, **opts):' | |||||
2169 |
|
2170 | |||
2170 | .. container:: verbose |
|
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 | Template: |
|
2176 | Template: | |
2173 |
|
2177 | |||
2174 | The following keywords are supported. See also :hg:`help templates`. |
|
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 | opts = pycompat.byteskwargs(opts) |
|
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 | if any(opts.get(o) for o in editopts): |
|
2194 | if any(opts.get(o) for o in editopts): | |
2191 | cmdutil.check_at_most_one_arg(opts, *editopts[1:]) |
|
2195 | cmdutil.check_at_most_one_arg(opts, *editopts[1:]) | |
2192 | if opts.get(b'local'): |
|
2196 | if opts.get(b'local'): | |
@@ -2208,6 +2212,8 b' def config(ui, repo, *values, **opts):' | |||||
2208 | ) |
|
2212 | ) | |
2209 | ) |
|
2213 | ) | |
2210 | paths = [vfsmod.vfs(repo.sharedpath).join(b'hgrc')] |
|
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 | else: |
|
2217 | else: | |
2212 | paths = rcutil.userrcpath() |
|
2218 | paths = rcutil.userrcpath() | |
2213 |
|
2219 |
@@ -987,6 +987,7 b' def _getlocal(ui, rpath, wd=None):' | |||||
987 | if rcutil.use_repo_hgrc(): |
|
987 | if rcutil.use_repo_hgrc(): | |
988 | _readsharedsourceconfig(lui, path) |
|
988 | _readsharedsourceconfig(lui, path) | |
989 | lui.readconfig(os.path.join(path, b".hg", b"hgrc"), path) |
|
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 | if rpath: |
|
992 | if rpath: | |
992 | path = lui.expandpath(rpath) |
|
993 | path = lui.expandpath(rpath) | |
@@ -994,6 +995,7 b' def _getlocal(ui, rpath, wd=None):' | |||||
994 | if rcutil.use_repo_hgrc(): |
|
995 | if rcutil.use_repo_hgrc(): | |
995 | _readsharedsourceconfig(lui, path) |
|
996 | _readsharedsourceconfig(lui, path) | |
996 | lui.readconfig(os.path.join(path, b".hg", b"hgrc"), path) |
|
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 | return path, lui |
|
1000 | return path, lui | |
999 |
|
1001 |
@@ -715,18 +715,28 b' def loadhgrc(ui, wdirvfs, hgvfs, require' | |||||
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 |
ret |
|
729 | ret = True | |
728 | except IOError: |
|
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 | def afterhgrcload(ui, wdirvfs, hgvfs, requirements): |
|
742 | def afterhgrcload(ui, wdirvfs, hgvfs, requirements): |
@@ -259,7 +259,7 b' Show all commands + options' | |||||
259 | cat: output, rev, decode, include, exclude, template |
|
259 | cat: output, rev, decode, include, exclude, template | |
260 | clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure |
|
260 | clone: noupdate, updaterev, rev, branch, pull, uncompressed, stream, ssh, remotecmd, insecure | |
261 | commit: addremove, close-branch, amend, secret, edit, force-close-branch, interactive, include, exclude, message, logfile, date, user, subrepos |
|
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 | continue: dry-run |
|
263 | continue: dry-run | |
264 | copy: forget, after, at-rev, force, include, exclude, dry-run |
|
264 | copy: forget, after, at-rev, force, include, exclude, dry-run | |
265 | debugancestor: |
|
265 | debugancestor: |
@@ -253,6 +253,25 b' Shared one should work' | |||||
253 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
253 | date: Thu Jan 01 00:00:00 1970 +0000 | |
254 | summary: added c |
|
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 | Unsharing works |
|
275 | Unsharing works | |
257 |
|
276 | |||
258 | $ hg unshare |
|
277 | $ hg unshare |
General Comments 0
You need to be logged in to leave comments.
Login now