mercurial/scmposix.py
changeset 30941 354020079723
parent 30641 16b5df5792a8
child 31339 7c09b071318a
--- a/mercurial/scmposix.py	Wed Feb 01 17:47:35 2017 +0100
+++ b/mercurial/scmposix.py	Tue Feb 07 17:33:35 2017 +0100
@@ -40,8 +40,15 @@
 def userrcpath():
     if pycompat.sysplatform == 'plan9':
         return [encoding.environ['home'] + '/lib/hgrc']
+    elif pycompat.sysplatform == 'darwin':
+        return [os.path.expanduser('~/.hgrc')]
     else:
-        return [os.path.expanduser('~/.hgrc')]
+        confighome = encoding.environ.get('XDG_CONFIG_HOME')
+        if confighome is None or not os.path.isabs(confighome):
+            confighome = os.path.expanduser('~/.config')
+
+        return [os.path.expanduser('~/.hgrc'),
+                os.path.join(confighome, 'hg', 'hgrc')]
 
 def termsize(ui):
     try: