diff mercurial/scmutil.py @ 23142:c4ce077588d0

config: introduce "built-in" default configuration settings in default.d This helps providing a more consistent user experience on all platforms and with all packaging. The exact location of default.d depends on how Mercurial is installed and whether it is 'frozen'. The exact location should never be relevant to users and is intentionally not explained in details in the documentation. It will however always be next to the help and templates files. Note that setting HGRCPATH also disables these defaults. I don't know if that should be considered a bug or a feature.
author Mads Kiilerich <madski@unity3d.com>
date Thu, 04 Sep 2014 21:36:35 +0200
parents 4d680deb0d9e
children 9f4778027bc2
line wrap: on
line diff
--- a/mercurial/scmutil.py	Sat Oct 18 21:48:38 2014 +0200
+++ b/mercurial/scmutil.py	Thu Sep 04 21:36:35 2014 +0200
@@ -495,7 +495,13 @@
 
 def osrcpath():
     '''return default os-specific hgrc search path'''
-    path = systemrcpath()
+    path = []
+    defaultpath = os.path.join(util.datapath, 'default.d')
+    if os.path.isdir(defaultpath):
+        for f, kind in osutil.listdir(defaultpath):
+            if f.endswith('.rc'):
+                path.append(os.path.join(defaultpath, f))
+    path.extend(systemrcpath())
     path.extend(userrcpath())
     path = [os.path.normpath(f) for f in path]
     return path