changeset 39043:d56a6b78de3b

changegroup: invert conditional and dedent I don't like seeing code that visually resembles the pyramid of doom. Differential Revision: https://phab.mercurial-scm.org/D4197
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 07 Aug 2018 15:13:25 -0700
parents e11d07cc125c
children 5959ef78d834
files mercurial/changegroup.py
diffstat 1 files changed, 16 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changegroup.py	Tue Aug 07 15:10:38 2018 -0700
+++ b/mercurial/changegroup.py	Tue Aug 07 15:13:25 2018 -0700
@@ -1048,20 +1048,24 @@
             dir, nodes = tmfnodes.popitem()
             store = dirlog(dir)
             prunednodes = self._prune(store, nodes, commonrevs)
-            if not dir or prunednodes:
-                lookupfn = makelookupmflinknode(dir, nodes)
+
+            if dir and not prunednodes:
+                continue
+
+            lookupfn = makelookupmflinknode(dir, nodes)
 
-                if self._ellipses:
-                    revs = _sortnodesellipsis(store, prunednodes, cl,
-                                              lookupfn)
-                else:
-                    revs = _sortnodesnormal(store, prunednodes,
-                                            self._reorder)
+            if self._ellipses:
+                revs = _sortnodesellipsis(store, prunednodes, cl,
+                                          lookupfn)
+            else:
+                revs = _sortnodesnormal(store, prunednodes,
+                                        self._reorder)
 
-                for x in self._packmanifests(dir, store, revs, lookupfn,
-                                             clrevtolocalrev):
-                    size += len(x)
-                    yield x
+            for x in self._packmanifests(dir, store, revs, lookupfn,
+                                         clrevtolocalrev):
+                size += len(x)
+                yield x
+
         self._verbosenote(_('%8.i (manifests)\n') % size)
         yield self._manifestsend