changeset 3807:03ccdc753582

evolve: commit the transaction if conflicts occur while merging content-div Yes, let's commit the transaction in case conflicts occur. Yes, this is what unshelve does and this is one of the reasons we don't like unshelve. Previous patches added support for resolving content-divergence when they are on different parents with parent of one being the gca. In such cases, we relocate one of the divergent commit to the parent of another one. All the relocation stuff and merging divergent changeset stuff happens in a single transaction, so if there are conflicts while merging, we abort and the transaction rollsback and our relocated commit is not applied after abort. We don't want to process the relocation because that can lead to conflicts and we will have dirty wdir because of resolving conflicts. So, we commit the transaction when merging results in conflicts to make sure if relocation happened, we commit that. This fixes the absence of relocation commit found in previous patch and uncover a new bug about handling of relocated commit. Upcoming patch will fix it.
author Pulkit Goyal <7895pulkit@gmail.com>
date Thu, 07 Jun 2018 20:27:03 +0530
parents 99469bb3854e
children e6c0f45d51ed
files hgext3rd/evolve/evolvecmd.py tests/test-evolve-content-divergence.t
diffstat 2 files changed, 38 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py	Thu Jun 07 15:54:32 2018 +0530
+++ b/hgext3rd/evolve/evolvecmd.py	Thu Jun 07 20:27:03 2018 +0530
@@ -468,6 +468,8 @@
 
     # conflicts while merging content-divergent changesets
     if compat.hasconflict(stats):
+        tr = repo.currenttransaction()
+        tr.close()
         evolvestate.save()
         raise error.Abort(_("fix conflicts and run 'hg evolve --continue' or"
                             " use 'hg update -C .' to abort"))
--- a/tests/test-evolve-content-divergence.t	Thu Jun 07 15:54:32 2018 +0530
+++ b/tests/test-evolve-content-divergence.t	Thu Jun 07 20:27:03 2018 +0530
@@ -532,8 +532,6 @@
   merging y
   warning: conflicts while merging y! (edit, then use 'hg resolve --mark')
   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
-  transaction abort!
-  rollback completed
   abort: fix conflicts and run 'hg evolve --continue' or use 'hg update -C .' to abort
   [255]
 
@@ -545,8 +543,10 @@
   working directory is now at bbaca013758a
 
   $ hg glog
-  @  19:bbaca013758a added y
+  @  20:bbaca013758a added y
   |   () [bar] draft
+  | *  19:6d515d1ffc69 added y
+  |/    () [default] draft
   o  14:be41fdcd0ee1 added foo to x
   |   () [bar] draft
   o  9:b6b20b8eefdc added d
@@ -560,7 +560,38 @@
   o  0:8fa14d15e168 added hgignore
       () [default] draft
 
+  $ hg obslog -r . --all
+  *  6d515d1ffc69 (19) added y
+  |
+  | @  bbaca013758a (20) added y
+  |/|
+  x |  29e08829c51f (16) added y
+  | |    rewritten(parent) as 6d515d1ffc69 using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |    rewritten(branch, parent, content) as bbaca013758a using evolve by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  4065e1d314c3 (18) added y
+  | |    rewritten(content) as bbaca013758a using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  | |
+  | x  f1d75198aac4 (17) added y
+  |/     rewritten(content) as 4065e1d314c3 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+  |
+  x  9c30046901ab (15) added y
+       rewritten(content) as 29e08829c51f using amend by test (Thu Jan 01 00:00:00 1970 +0000)
+       rewritten(branch, parent) as f1d75198aac4 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
+  
+
 checking that relocated commit is there
   $ hg exp 6d515d1ffc69 --hidden
-  abort: unknown revision '6d515d1ffc69'!
-  [255]
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #      Thu Jan 01 00:00:00 1970 +0000
+  # Node ID 6d515d1ffc6925b036c933078ccb804c26da80b2
+  # Parent  be41fdcd0ee181081c4e42c6ee333d3dc3b3ab45
+  added y
+  
+  diff -r be41fdcd0ee1 -r 6d515d1ffc69 y
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/y	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +bar