comparison mercurial/commands.py @ 45921:777e8d88f703

commands: fix checking of share safe requirement on `config --shared` The `if requirements.SHARESAFE_REQUIREMENT in ...` was wrongly placed inside another if statement which made the check unreachable. Differential Revision: https://phab.mercurial-scm.org/D9360
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 21 Nov 2020 13:30:50 +0530
parents 50afeeeb7b79
children 89a2afe31e82
comparison
equal deleted inserted replaced
45920:1441f4d57083 45921:777e8d88f703
2225 elif opts.get(b'shared'): 2225 elif opts.get(b'shared'):
2226 if not repo.shared(): 2226 if not repo.shared():
2227 raise error.InputError( 2227 raise error.InputError(
2228 _(b"repository is not shared; can't use --shared") 2228 _(b"repository is not shared; can't use --shared")
2229 ) 2229 )
2230 if requirements.SHARESAFE_REQUIREMENT not in repo.requirements: 2230 if requirements.SHARESAFE_REQUIREMENT not in repo.requirements:
2231 raise error.InputError( 2231 raise error.InputError(
2232 _( 2232 _(
2233 b"share safe feature not unabled; " 2233 b"share safe feature not enabled; "
2234 b"unable to edit shared source repository config" 2234 b"unable to edit shared source repository config"
2235 )
2236 ) 2235 )
2236 )
2237 paths = [vfsmod.vfs(repo.sharedpath).join(b'hgrc')] 2237 paths = [vfsmod.vfs(repo.sharedpath).join(b'hgrc')]
2238 elif opts.get(b'non_shared'): 2238 elif opts.get(b'non_shared'):
2239 paths = [repo.vfs.join(b'hgrc-not-shared')] 2239 paths = [repo.vfs.join(b'hgrc-not-shared')]
2240 else: 2240 else:
2241 paths = rcutil.userrcpath() 2241 paths = rcutil.userrcpath()