Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/rcutil.py @ 31699:10d88dc7c010
rcutil: extract duplicated logic to a lambda
This simplifies the code a bit.
author | Jun Wu <quark@fb.com> |
---|---|
date | Tue, 28 Mar 2017 07:57:56 -0700 |
parents | 67f0377bd24b |
children | e518192d6bac |
comparison
equal
deleted
inserted
replaced
31698:67f0377bd24b | 31699:10d88dc7c010 |
---|---|
83 for p in encoding.environ['HGRCPATH'].split(pycompat.ospathsep): | 83 for p in encoding.environ['HGRCPATH'].split(pycompat.ospathsep): |
84 if not p: | 84 if not p: |
85 continue | 85 continue |
86 _rccomponents.extend(('path', p) for p in _expandrcpath(p)) | 86 _rccomponents.extend(('path', p) for p in _expandrcpath(p)) |
87 else: | 87 else: |
88 paths = defaultrcpath() + systemrcpath() | 88 normpaths = lambda paths: [('path', os.path.normpath(p)) for p in paths] |
89 _rccomponents = [('path', os.path.normpath(p)) for p in paths] | 89 _rccomponents = normpaths(defaultrcpath() + systemrcpath()) |
90 _rccomponents.append(envrc) | 90 _rccomponents.append(envrc) |
91 paths = userrcpath() | 91 _rccomponents.extend(normpaths(userrcpath())) |
92 _rccomponents.extend(('path', os.path.normpath(p)) for p in paths) | |
93 return _rccomponents | 92 return _rccomponents |