[PATCH 04 of 10 V4] rcutil: rename rcpath to rccomponents (API)

Jun Wu quark at fb.com
Mon Mar 27 00:49:17 EDT 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1490586480 25200
#      Sun Mar 26 20:48:00 2017 -0700
# Node ID 8caf1898b14bd5017e1b66348e77194a6cb715e0
# Parent  30a341f7fd233e55615cab11a64a8a521f389783
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 8caf1898b14b
rcutil: rename rcpath to rccomponents (API)

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1804,5 +1804,5 @@ def config(ui, repo, *values, **opts):
     ui.pager('config')
     fm = ui.formatter('config', opts)
-    for f in rcutil.rcpath():
+    for f in rcutil.rccomponents():
         ui.debug('read config from: %s\n' % f)
     untrusted = bool(opts.get('untrusted'))
diff --git a/mercurial/rcutil.py b/mercurial/rcutil.py
--- a/mercurial/rcutil.py
+++ b/mercurial/rcutil.py
@@ -41,7 +41,7 @@ def defaultrcpath():
     return path
 
-_rcpath = None
+_rccomponents = None
 
-def rcpath():
+def rccomponents():
     '''return hgrc search path. if env var HGRCPATH is set, use it.
     for each item in path, if directory, use files ending in .rc,
@@ -49,14 +49,14 @@ def rcpath():
     make HGRCPATH empty to only look in .hg/hgrc of current repo.
     if no HGRCPATH, use default os-specific path.'''
-    global _rcpath
-    if _rcpath is None:
+    global _rccomponents
+    if _rccomponents is None:
         if 'HGRCPATH' in encoding.environ:
-            _rcpath = []
+            _rccomponents = []
             for p in encoding.environ['HGRCPATH'].split(pycompat.ospathsep):
                 if not p:
                     continue
-                _rcpath.extend(_expandrcpath(p))
+                _rccomponents.extend(_expandrcpath(p))
         else:
             paths = defaultrcpath() + systemrcpath() + userrcpath()
-            _rcpath = map(os.path.normpath, paths)
-    return _rcpath
+            _rccomponents = map(os.path.normpath, paths)
+    return _rccomponents
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -213,5 +213,5 @@ class ui(object):
         u = cls()
         # we always trust global config files
-        for f in rcutil.rcpath():
+        for f in rcutil.rccomponents():
             u.readconfig(f, trust=True)
         return u


More information about the Mercurial-devel mailing list