diff tests/test-stabilize-result.t @ 3846:f9dad99a90d5

evolve: create a new commit instead of amending one of the divergents This patch changes the behavior of evolve command while resolving content-divergence to create a new commit instead of amending one of the divergent ones. In past, I have made this change, backed out this change and now today again I am doing this change, so let's dive in some history. Using cmdrewrite.amend() was never a good option as that requires hack to delete the evolvestate and also gives us less control over things. We can't make the commit on top of different parents as that of content-divergent ones. Due to all these, I first made this change to create a new commit instead of amending one. But, after few days, there was flakiness observed in the tests and turned out that we need to do some dirstate dance as repo.dirstate.setparents() does not always fix the dirstate. That flakiness was a blocker for progress at that time and we decided to switch to amend back so that we can have things working with some hacks and we can later fix the implementation part. Now, yesterday while tackling resolving content-divergence of a stack which is as follows: C1 C2 | | B1 B2 | | A1 A2 \/ base where, A1-A2, B1-B2, C1-C2 are content-divergent with each other. Now we can resolve A1-A2 very well because they have the same parent and let's say that resolution leads to A3. Now, we want to resolve B1-B2 and make the new resolution commit on top of A3 so that we can end up something like: C3 | B3 | A3 | base however, amending one of the divergent changesets, it's not possible to create a commit on a different parent like A3 here without some relocation. We should prevent relocation as that may leads to some conflicts and should change the parent before committing. So, looking ahead, we can't move with using amend as still using that we will need some relocation hacks making code ugly and prone to bad behaviors, bugs. Let's change back to creating a new commit so that we can move forward in a good way. About repo.dirstate.setparents() not setting the dirstate, I have researched yesterday night about how we can do that and found out that we can use cmdrewrite._uncommitdirstate() here. Expect upcoming patches to improve the documentation of that function. There are lot of test changes because of change in hash but there is no behavior change. The only behavior change is in test-evolve-abort-contentdiv.t which is nice because creating a new commit helps us in stripping that while aborting. We have a lot of testing of content-divergence and no behavior change gives enough confidence for making this change. I reviewed the patch carefully to make sure there is no behavior change and I suggest reviewer to do the same.
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 13 Jun 2018 17:15:10 +0530
parents f0096db2a7b1
children 629558d09898
line wrap: on
line diff
--- a/tests/test-stabilize-result.t	Tue Jun 12 23:20:54 2018 +0530
+++ b/tests/test-stabilize-result.t	Wed Jun 13 17:15:10 2018 +0530
@@ -292,16 +292,14 @@
   resolving manifests
   merging a
   0 files updated, 1 files merged, 0 files removed, 0 files unresolved
-  amending changeset eacc9c8240fe
   committing files:
   a
   committing manifest
   committing changelog
-  committed changeset 15:f344982e63c4
-  working directory is now at f344982e63c4
+  working directory is now at 4d6ed26797bc
   $ hg st
   $ glog
-  @  15:f344982e63c4@default(draft) bk:[] More addition
+  @  15:4d6ed26797bc@default(draft) bk:[] More addition
   |
   | o  11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
   | |
@@ -314,7 +312,7 @@
   o  0:07f494440405@default(public) bk:[] adda
   
   $ hg summary
-  parent: 15:f344982e63c4 tip
+  parent: 15:4d6ed26797bc tip
    More addition
   branch: default
   commit: (clean)
@@ -325,11 +323,11 @@
   # User test
   # Date 0 0
   #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID f344982e63c462b1e44c0371c804685389e673a9
+  # Node ID 4d6ed26797bc392c0099e48402a5134e669f1a60
   # Parent  7bc2f5967f5e4ed277f60a89b7b04cc5d6407ced
   More addition
   
-  diff -r 7bc2f5967f5e -r f344982e63c4 a
+  diff -r 7bc2f5967f5e -r 4d6ed26797bc a
   --- a/a	Thu Jan 01 00:00:00 1970 +0000
   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
   @@ -1,1 +1,9 @@
@@ -349,9 +347,9 @@
   $ hg up --hidden 3932c176bbaa
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   updated to hidden changeset 3932c176bbaa
-  (hidden revision '3932c176bbaa' was rewritten as: f344982e63c4)
+  (hidden revision '3932c176bbaa' was rewritten as: 4d6ed26797bc)
   working directory parent is obsolete! (3932c176bbaa)
-  (use 'hg evolve' to update to its successor: f344982e63c4)
+  (use 'hg evolve' to update to its successor: 4d6ed26797bc)
   $ echo 'gotta break' >> a
   $ hg amend
   2 new content-divergent changesets
@@ -364,7 +362,7 @@
   $ glog
   @  17:0b336205a5d0@default(draft) bk:[] More addition (2)
   |
-  | *  15:f344982e63c4@default(draft) bk:[] More addition
+  | *  15:4d6ed26797bc@default(draft) bk:[] More addition
   |/
   | o  11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
   | |
@@ -379,8 +377,8 @@
 
   $ hg evolve -qn --content-divergent
   hg update -c 0b336205a5d0 &&
-  hg merge f344982e63c4 &&
-  hg commit -m "auto merge resolving conflict between 0b336205a5d0 and f344982e63c4"&&
+  hg merge 4d6ed26797bc &&
+  hg commit -m "auto merge resolving conflict between 0b336205a5d0 and 4d6ed26797bc"&&
   hg up -C 3932c176bbaa &&
   hg revert --all --rev tip &&
   hg commit -m "`hg log -r 0b336205a5d0 --template={desc}`";
@@ -388,7 +386,7 @@
   merge:[17] More addition (2)
   with: [15] More addition
   base: [12] More addition
-  merging "other" content-divergent changeset 'f344982e63c4'
+  merging "other" content-divergent changeset '4d6ed26797bc'
   merging a
   warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
@@ -411,9 +409,9 @@
   (no more unresolved files)
   continue: hg evolve --continue
   $ hg evolve --continue
-  working directory is now at e015aa78acee
+  working directory is now at e8746835a2a1
   $ glog
-  @  18:e015aa78acee@default(draft) bk:[] More addition (2)
+  @  18:e8746835a2a1@default(draft) bk:[] More addition (2)
   |
   | o  11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363:
   | |
@@ -430,11 +428,11 @@
   # User test
   # Date 0 0
   #      Thu Jan 01 00:00:00 1970 +0000
-  # Node ID e015aa78acee692d26215fafdb7f70974682739c
+  # Node ID e8746835a2a13122bc8c0ed84fe4ee35649af25d
   # Parent  7bc2f5967f5e4ed277f60a89b7b04cc5d6407ced
   More addition (2)
   
-  diff -r 7bc2f5967f5e -r e015aa78acee a
+  diff -r 7bc2f5967f5e -r e8746835a2a1 a
   --- a/a	Thu Jan 01 00:00:00 1970 +0000
   +++ b/a	Thu Jan 01 00:00:00 1970 +0000
   @@ -1,1 +1,9 @@