Mercurial > hg
comparison mercurial/scmposix.py @ 51607:a4b3b8dee0a8
hgrc: search XDG_CONFIG_HOME on mac
Searching for hgrc was special cased not to look through ~/.config/hg on Mac,
but that’s unnecessary: Macs support it as do other unix based systems. There
are plenty tools that use it there, e.g. git, and people expect it to work, e.g.
"https://stackoverflow.com/questions/72499837/mercurial-on-macos-doesnt-read-config-hg-hgrc".
Initial code introduced in 354020079723.
author | Hraban Luyat <hraban@0brg.net> |
---|---|
date | Tue, 26 Mar 2024 01:27:27 -0400 |
parents | 9d3721552b6c |
children | f4733654f144 |
comparison
equal
deleted
inserted
replaced
51606:55e7784eb3bc | 51607:a4b3b8dee0a8 |
---|---|
58 | 58 |
59 | 59 |
60 def userrcpath() -> List[bytes]: | 60 def userrcpath() -> List[bytes]: |
61 if pycompat.sysplatform == b'plan9': | 61 if pycompat.sysplatform == b'plan9': |
62 return [encoding.environ[b'home'] + b'/lib/hgrc'] | 62 return [encoding.environ[b'home'] + b'/lib/hgrc'] |
63 elif pycompat.isdarwin: | |
64 return [os.path.expanduser(b'~/.hgrc')] | |
65 else: | 63 else: |
66 confighome = encoding.environ.get(b'XDG_CONFIG_HOME') | 64 confighome = encoding.environ.get(b'XDG_CONFIG_HOME') |
67 if confighome is None or not os.path.isabs(confighome): | 65 if confighome is None or not os.path.isabs(confighome): |
68 confighome = os.path.expanduser(b'~/.config') | 66 confighome = os.path.expanduser(b'~/.config') |
69 | 67 |