[PATCH 03 of 13 V3] scmutil: split osrcpath to return default.d paths (API)
Jun Wu
quark at fb.com
Wed Mar 22 13:23:35 EDT 2017
# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1490165660 25200
# Tue Mar 21 23:54:20 2017 -0700
# Node ID ca711190cb22ea50baac89c75f1a621c67d5754f
# Parent 61757ff29df4a35351fd31568a14e0880dd5c2d4
# Available At https://bitbucket.org/quark-zju/hg-draft
# hg pull https://bitbucket.org/quark-zju/hg-draft -r ca711190cb22
scmutil: split osrcpath to return default.d paths (API)
After this change, there are 3 rcpath functions:
- defaultrcpath
- systemrcpath
- userrcpath
This will allow us to insert another config layer in the middle.
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -392,6 +392,6 @@ def walkrepos(path, followsym=False, see
dirs[:] = newdirs
-def osrcpath():
- '''return default os-specific hgrc search path'''
+def defaultrcpath():
+ '''return rc paths in default.d'''
path = []
defaultpath = os.path.join(util.datapath, 'default.d')
@@ -400,7 +400,4 @@ def osrcpath():
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
@@ -449,5 +446,6 @@ def rcpath():
_rcpath.append(p)
else:
- _rcpath = osrcpath()
+ paths = defaultrcpath() + systemrcpath() + userrcpath()
+ _rcpath = map(os.path.normpath, paths)
return _rcpath
More information about the Mercurial-devel
mailing list