rcutil: extract duplicated logic to a lambda
authorJun Wu <quark@fb.com>
Tue, 28 Mar 2017 07:57:56 -0700
changeset 31694 10d88dc7c010
parent 31693 67f0377bd24b
child 31695 d73490957d61
rcutil: extract duplicated logic to a lambda This simplifies the code a bit.
mercurial/rcutil.py
--- 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