Add support for /etc/mercurial/hgrc.d/*.rc
authormpm@selenic.com
Fri, 23 Sep 2005 19:35:23 -0700
changeset 1343 0f4e53e8c66b
parent 1342 5a42da1db402
child 1344 ca0e27e05de3
Add support for /etc/mercurial/hgrc.d/*.rc
mercurial/util.py
--- a/mercurial/util.py	Fri Sep 23 19:04:19 2005 -0700
+++ b/mercurial/util.py	Fri Sep 23 19:35:23 2005 -0700
@@ -426,8 +426,12 @@
 else:
     nulldev = '/dev/null'
 
-    rcpath = map(os.path.normpath,
-                 ('/etc/mercurial/hgrc', os.path.expanduser('~/.hgrc')))
+    hgrcd = '/etc/mercurial/hgrc.d'
+    hgrcs = []
+    if os.path.isdir(hgrcd):
+        hgrcs = [f for f in os.listdir(hgrcd) if f.endswith(".rc")]
+    rcpath = map(os.path.normpath, hgrcs +
+                 ['/etc/mercurial/hgrc', os.path.expanduser('~/.hgrc')])
 
     def parse_patch_output(output_line):
         """parses the output produced by patch and returns the file name"""