changeset 31694: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 d73490957d61
files mercurial/rcutil.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/rcutil.py	Tue Mar 28 07:55:32 2017 -0700
+++ b/mercurial/rcutil.py	Tue Mar 28 07:57:56 2017 -0700
@@ -85,9 +85,8 @@
                 continue
             _rccomponents.extend(('path', p) for p in _expandrcpath(p))
     else:
-        paths = defaultrcpath() + systemrcpath()
-        _rccomponents = [('path', os.path.normpath(p)) for p in paths]
+        normpaths = lambda paths: [('path', os.path.normpath(p)) for p in paths]
+        _rccomponents = normpaths(defaultrcpath() + systemrcpath())
         _rccomponents.append(envrc)
-        paths = userrcpath()
-        _rccomponents.extend(('path', os.path.normpath(p)) for p in paths)
+        _rccomponents.extend(normpaths(userrcpath()))
     return _rccomponents