##// END OF EJS Templates
hg: allow usage of XDG_CONFIG_HOME/hg/hgrc...
David Demelier -
r30941:35402007 default
parent child Browse files
Show More
@@ -0,0 +1,11 b''
1 #if no-windows no-osx
2
3 $ mkdir -p xdgconf/hg
4 $ echo '[ui]' > xdgconf/hg/hgrc
5 $ echo 'username = foobar' >> xdgconf/hg/hgrc
6 $ XDG_CONFIG_HOME="`pwd`/xdgconf" ; export XDG_CONFIG_HOME
7 $ unset HGRCPATH
8 $ hg config ui.username
9 foobar
10
11 #endif
@@ -56,6 +56,7 b' ones.'
56
56
57 - ``<repo>/.hg/hgrc`` (per-repository)
57 - ``<repo>/.hg/hgrc`` (per-repository)
58 - ``$HOME/.hgrc`` (per-user)
58 - ``$HOME/.hgrc`` (per-user)
59 - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
59 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
60 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
60 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
61 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
61 - ``/etc/mercurial/hgrc`` (per-system)
62 - ``/etc/mercurial/hgrc`` (per-system)
@@ -40,8 +40,15 b' def systemrcpath():'
40 def userrcpath():
40 def userrcpath():
41 if pycompat.sysplatform == 'plan9':
41 if pycompat.sysplatform == 'plan9':
42 return [encoding.environ['home'] + '/lib/hgrc']
42 return [encoding.environ['home'] + '/lib/hgrc']
43 elif pycompat.sysplatform == 'darwin':
44 return [os.path.expanduser('~/.hgrc')]
43 else:
45 else:
44 return [os.path.expanduser('~/.hgrc')]
46 confighome = encoding.environ.get('XDG_CONFIG_HOME')
47 if confighome is None or not os.path.isabs(confighome):
48 confighome = os.path.expanduser('~/.config')
49
50 return [os.path.expanduser('~/.hgrc'),
51 os.path.join(confighome, 'hg', 'hgrc')]
45
52
46 def termsize(ui):
53 def termsize(ui):
47 try:
54 try:
General Comments 0
You need to be logged in to leave comments. Login now