Patchwork [2,of,3] rcutil: unindent a block

login
register
mail settings
Submitter Jun Wu
Date March 28, 2017, 3:02 p.m.
Message ID <3990935c7f25e9e42309.1490713375@localhost.localdomain>
Download mbox | patch
Permalink /patch/19787/
State Accepted
Headers show

Comments

Jun Wu - March 28, 2017, 3:02 p.m.
# HG changeset patch
# User Jun Wu <quark@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.

Patch

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