[PATCH 2 of 3] rcutil: unindent a block

Jun Wu quark at fb.com
Tue Mar 28 11:02:55 EDT 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1490712932 25200
#      Tue Mar 28 07:55:32 2017 -0700
# Node ID 3990935c7f25e9e42309cbad92e888a1201ac751
# Parent  f1c156c854ce36010008816ed6c5097a809ba5e5
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 3990935c7f25
rcutil: unindent a block

Since global _rccomponents is gone, the code could be simplified.

diff --git a/mercurial/rcutil.py b/mercurial/rcutil.py
--- a/mercurial/rcutil.py
+++ b/mercurial/rcutil.py
@@ -77,19 +77,17 @@ def rccomponents():
     envrc = ('items', envrcitems())
 
-    _rccomponents = None
-    if _rccomponents is None:
-        if 'HGRCPATH' in encoding.environ:
-            # assume HGRCPATH is all about user configs so environments can be
-            # overridden.
-            _rccomponents = [envrc]
-            for p in encoding.environ['HGRCPATH'].split(pycompat.ospathsep):
-                if not p:
-                    continue
-                _rccomponents.extend(('path', p) for p in _expandrcpath(p))
-        else:
-            paths = defaultrcpath() + systemrcpath()
-            _rccomponents = [('path', os.path.normpath(p)) for p in paths]
-            _rccomponents.append(envrc)
-            paths = userrcpath()
-            _rccomponents.extend(('path', os.path.normpath(p)) for p in paths)
+    if 'HGRCPATH' in encoding.environ:
+        # assume HGRCPATH is all about user configs so environments can be
+        # overridden.
+        _rccomponents = [envrc]
+        for p in encoding.environ['HGRCPATH'].split(pycompat.ospathsep):
+            if not p:
+                continue
+            _rccomponents.extend(('path', p) for p in _expandrcpath(p))
+    else:
+        paths = defaultrcpath() + systemrcpath()
+        _rccomponents = [('path', os.path.normpath(p)) for p in paths]
+        _rccomponents.append(envrc)
+        paths = userrcpath()
+        _rccomponents.extend(('path', os.path.normpath(p)) for p in paths)
     return _rccomponents


More information about the Mercurial-devel mailing list