Patchwork [04,of,10,V5] rcutil: rename rcpath to rccomponents (API)

login
register
mail settings
Submitter Jun Wu
Date March 27, 2017, 6:02 a.m.
Message ID <86998401114d7e4ae6d1.1490594523@localhost.localdomain>
Download mbox | patch
Permalink /patch/19745/
State Accepted
Headers show

Comments

Jun Wu - March 27, 2017, 6:02 a.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1490586480 25200
#      Sun Mar 26 20:48:00 2017 -0700
# Node ID 86998401114d7e4ae6d1c70b4e1b95b74dd1d6e3
# Parent  3d461afe19576560b9b43b4460dd850abbdbd5fe
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 86998401114d
rcutil: rename rcpath to rccomponents (API)

Patch

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