# HG changeset patch # User Jun Wu # Date 2017-03-28 14:55:32 # Node ID 67f0377bd24bca396473e60743eb80e765f98b8a # Parent cf052cc5c2c26133aaa6ea8536a4919a89ab008e 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 @@ -76,20 +76,18 @@ 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