changeset 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 d9ba836fc234
children b99903534e06
files mercurial/scmutil.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
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)