diff mercurial/scmutil.py @ 39895:1c3f1491965f

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.
author Boris Feld <boris.feld@octobus.net>
date Thu, 27 Sep 2018 13:54:37 -0700
parents f1d6021453c2
children b99903534e06
line wrap: on
line diff
--- 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)