evolve: further simplify a conditional
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 26 Dec 2019 20:28:21 +0100
changeset 5032 31b0b29245bb
parent 5031 ef1978a0fcc0
child 5033 7cc3d96eb589
evolve: further simplify a conditional The case is simple enough to be handled on its own.
hgext3rd/evolve/evolvecmd.py
--- a/hgext3rd/evolve/evolvecmd.py	Thu Dec 26 20:23:27 2019 +0100
+++ b/hgext3rd/evolve/evolvecmd.py	Thu Dec 26 20:28:21 2019 +0100
@@ -430,28 +430,27 @@
     # for 2) we will relocate one which is behind to the parent of ahead one and
     # then solve the content-divergence the way we solve 1)
     # for 3) and 4), we still have to decide
-    if succsotherp1 in gca and succsdivp1 in gca:
-        if succsotherp1 == otherp1 and succsdivp1 == divp1:
-            # both are on the same parents
+    if otherp1 == divp1:
+        # both are on the same parents
+        pass
+    elif succsotherp1 in gca and succsdivp1 in gca:
+        # both are not on the same parent but have same parents's succs.
+        if otheronly and divonly:
+            # case: we have visible csets on both side diverging from
+            # tca of "divergent" and "other". We still need to decide what
+            # to do in this case
             pass
+        if otheronly:
+            relocatereq = True
+            if not haspubdiv:
+                # can't swap when public divergence, as public can't move
+                divergent, other = swapnodes(divergent, other)
+                resolutionparent = repo[succsotherp1].node()
+        elif divonly:
+            relocatereq = True
         else:
-            # both are not on the same parent but have same parents's succs.
-            if otheronly and divonly:
-                # case: we have visible csets on both side diverging from
-                # tca of "divergent" and "other". We still need to decide what
-                # to do in this case
-                pass
-            if otheronly:
-                relocatereq = True
-                if not haspubdiv:
-                    # can't swap when public divergence, as public can't move
-                    divergent, other = swapnodes(divergent, other)
-                    resolutionparent = repo[succsotherp1].node()
-            elif divonly:
-                relocatereq = True
-            else:
-                # no extra cset on either side; so not considering relocation
-                pass
+            # no extra cset on either side; so not considering relocation
+            pass
     elif succsotherp1 in gca and succsdivp1 not in gca:
         relocatereq = True
         pass