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.
--- 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)