equal
deleted
inserted
replaced
2137 b'', |
2137 b'', |
2138 b'shared', |
2138 b'shared', |
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, |
2145 _(b'[-u] [NAME]...'), |
2146 _(b'[-u] [NAME]...'), |
2146 helpcategory=command.CATEGORY_HELP, |
2147 helpcategory=command.CATEGORY_HELP, |
2167 |
2168 |
2168 See :hg:`help config` for more information about config files. |
2169 See :hg:`help config` for more information about config files. |
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`. |
2175 |
2179 |
2176 :name: String. Config name. |
2180 :name: String. Config name. |
2184 Returns 0 on success, 1 if NAME does not exist. |
2188 Returns 0 on success, 1 if NAME does not exist. |
2185 |
2189 |
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'): |
2193 if not repo: |
2197 if not repo: |
2194 raise error.Abort(_(b"can't use --local outside a repository")) |
2198 raise error.Abort(_(b"can't use --local outside a repository")) |
2206 b"share safe feature not unabled; " |
2210 b"share safe feature not unabled; " |
2207 b"unable to edit shared source repository config" |
2211 b"unable to edit shared source repository config" |
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 |
2214 for f in paths: |
2220 for f in paths: |
2215 if os.path.exists(f): |
2221 if os.path.exists(f): |