scmutil: expand long "one-liner"
authorBoris Feld <boris.feld@octobus.net>
Thu, 27 Sep 2018 13:54:37 -0700
changeset 39890 1c3f1491965f
parent 39889 d9ba836fc234
child 39891 b99903534e06
scmutil: expand long "one-liner" When a one-liner gets 3 lines longs, it loses its expressivity benefits. We expand it into a simple for loop. This makes future changes of the code in that area clearer.
mercurial/scmutil.py
--- a/mercurial/scmutil.py	Thu Sep 20 17:47:05 2018 +0200
+++ b/mercurial/scmutil.py	Thu Sep 27 13:54:37 2018 -0700
@@ -968,9 +968,11 @@
             isobs = unfi.obsstore.successors.__contains__
             torev = unfi.changelog.rev
             sortfunc = lambda ns: torev(ns[0])
-            rels = [(unfi[n], tuple(unfi[m] for m in s))
-                    for n, s in sorted(replacements.items(), key=sortfunc)
-                    if s or not isobs(n)]
+            rels = []
+            for n, s in sorted(replacements.items(), key=sortfunc):
+                if s or not isobs(n):
+                    rel = (unfi[n], tuple(unfi[m] for m in s))
+                    rels.append(rel)
             if rels:
                 obsolete.createmarkers(repo, rels, operation=operation,
                                        metadata=metadata)