[PATCH 1 of 3] give etc/mercurial/hgrc precedence over etc/mercurial/hgrc.d/*.rc

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Fri Mar 7 01:50:15 CST 2008

# HG changeset patch
# User Peter Arrenbrecht <peter.arrenbrecht at gmail.com>
# Date 1204873325 -3600
# Node ID 85d363b7258b2940b014598fd103ea53b4590302
# Parent  6d3a202bd47952e034699b63726d1e140b9ab579
give etc/mercurial/hgrc precedence over etc/mercurial/hgrc.d/*.rc

`man hgrc` suggests that hgrc comes later than hgrc.d/*.rc and
thus hgrc should override hgrc.d/*.rc. I think this is appropriate
as hgrc is where users are likely to put things, whereas hgrc.d
is where automatic package config ends up.

This precedence is now reflected in the code.

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1098,7 +1098,7 @@ else:
     nulldev = '/dev/null'
     def rcfiles(path):
-        rcs = [os.path.join(path, 'hgrc')]
+        rcs = []
         rcdir = os.path.join(path, 'hgrc.d')
             rcs.extend([os.path.join(rcdir, f)
@@ -1106,6 +1106,7 @@ else:
                         if f.endswith(".rc")])
         except OSError:
+        rcs.append(os.path.join(path, 'hgrc'))
         return rcs
     def system_rcpath():

More information about the Mercurial-devel mailing list