# HG changeset patch
# User Boris Feld <boris.f...@octobus.net>
# Date 1537983753 -7200
#      Wed Sep 26 19:42:33 2018 +0200
# Node ID 4b1a3cbca27b5b8465435d29a476c8c1391d2904
# Parent  bce1c1af7518e87a6b8ee0761d8976c4b75da1b1
# EXP-Topic trackfold
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
4b1a3cbca27b
cleanupnodes: 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.

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -968,9 +968,11 @@ def cleanupnodes(repo, replacements, ope
             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)
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to