rebase: expand a long "one-liner"
authorBoris Feld <boris.feld@octobus.net>
Thu, 27 Sep 2018 00:15:21 +0200
changeset 39922 a8ccd9523d40
parent 39921 1857f50a9643
child 39923 a8318c9cb2ad
rebase: expand a long "one-liner" When a one-liner gets 3 lines longs, it lose its expressivity benefits. We expand it into a simple for loop. This makes future changes of the code in that area clearer.
hgext/rebase.py
--- a/hgext/rebase.py	Wed Sep 26 21:28:21 2018 +0200
+++ b/hgext/rebase.py	Thu Sep 27 00:15:21 2018 +0200
@@ -1783,9 +1783,10 @@
         hf = fm.hexfunc
         fl = fm.formatlist
         fd = fm.formatdict
-        nodechanges = fd({hf(oldn): fl([hf(n) for n in newn], name='node')
-                          for oldn, newn in replacements.iteritems()},
-                         key="oldnode", value="newnodes")
+        changes = {}
+        for oldn, newn in replacements.iteritems():
+            changes[hf(oldn)] = fl([hf(n) for n in newn], name='node')
+        nodechanges = fd(changes, key="oldnode", value="newnodes")
         fm.data(nodechanges=nodechanges)
 
 def pullrebase(orig, ui, repo, *args, **opts):