hgext3rd/evolve/evolvecmd.py
changeset 3790 5b9e3aaa6da8
parent 3789 13eef43a961f
child 3792 bb7d1616407f
--- a/hgext3rd/evolve/evolvecmd.py	Tue Jun 05 03:51:01 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Mon Jun 04 04:03:02 2018 +0530
@@ -456,6 +456,34 @@
         # interrupted evolve
         evolvestate.delete()
 
+        divbranch = divergent.branch()
+        basebranch = base.branch()
+        othbranch = other.branch()
+        # content divergent changes were on different branches, ask user to
+        # select one
+        if divbranch != othbranch:
+
+            if basebranch == othbranch and basebranch != divbranch:
+                # we will be amending the divergent changeset so branch will be
+                # preserved
+                pass
+            elif basebranch == divbranch and basebranch != othbranch:
+                repo.dirstate.setbranch(othbranch)
+            else:
+                # all the three branches are different
+                index = ui.promptchoice(_("content divergent changesets on "
+                                          "different branches.\nchoose branch"
+                                          " for the resolution changeset. (a) "
+                                          "%s or (b) %s or (c) %s? $$ &a $$ &b"
+                                          " $$ &c") %
+                                        (basebranch, divbranch, othbranch), 0)
+            if index == 0:
+                repo.dirstate.setbranch(basebranch)
+            elif index == 1:
+                pass
+            elif index == 2:
+                repo.dirstate.setbranch(othbranch)
+
         # XXX: we should not use amend here, rather create a new commit
         cmdrewrite.amend(ui, repo, message='', logfile='')
         # XXX: we can get rid of this len() call also by creating a new commit