changeset 3545:6aff754c2457

evolve: make sure we consider all cases in if-else The part of code which is touched decides on evolution of merge changeset. We need proper handling of each case there, so before adding logic, let's add conditional for each case so that upcoming patches are easy to understand.
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 18 Mar 2018 01:27:02 +0530
parents 329056287ef5
children d197e6f0d0e3
files hgext3rd/evolve/evolvecmd.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py	Mon Mar 19 14:03:41 2018 +0100
+++ b/hgext3rd/evolve/evolvecmd.py	Sun Mar 18 01:27:02 2018 +0530
@@ -91,10 +91,14 @@
     pctx = orig.p1()
     keepbranch = orig.p1().branch() != orig.branch()
     if len(orig.parents()) == 2:
-        if not pctx.obsolete():
+        p1obs = orig.p1().obsolete()
+        p2obs = orig.p2().obsolete()
+        if not p1obs and p2obs:
             pctx = orig.p2()  # second parent is obsolete ?
             keepbranch = orig.p2().branch() != orig.branch()
-        elif orig.p2().obsolete():
+        elif not p2obs and p1obs:
+            pass
+        else:
             hint = _("Redo the merge (%s) and use `hg prune <old> "
                      "--succ <new>` to obsolete the old one") % orig.hex()[:12]
             ui.warn(_("warning: no support for evolving merge changesets "