changeset 4990:f3fd3c1c3da0 stable

evolve: add test to demonstrate issue6203 Current logic of content-divergence resolution contains a bug that if resolution parent is not the parent of any of the two divergent changesets, it could undo some changes. I think a good solution for this is to first relocate the divergent cset to it's obsolete parent's successor if applicable and then perform the content-divergence resolution. Next patch will fix the issue.
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Sat, 23 Nov 2019 20:25:16 +0530
parents 25532ce787d9
children 2928f35023a1
files tests/test-evolve-content-divergent-stack.t
diffstat 1 files changed, 162 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-evolve-content-divergent-stack.t	Mon Dec 09 16:01:56 2019 +0700
+++ b/tests/test-evolve-content-divergent-stack.t	Sat Nov 23 20:25:16 2019 +0530
@@ -343,3 +343,165 @@
   o  0:8fa14d15e168 added hgignore
       () [default] draft
   $ cd ..
+
+Make sure that content-divergent resolution doesn't undo a change (issue6203)
+-----------------------------------------------------------------------------
+
+  $ hg init issue6203
+  $ cd issue6203
+  $ echo a > a; hg add a; hg ci -m a
+  $ echo 'b with typo' > b; hg add b; hg ci -m b
+  $ echo c > c; hg add c; hg ci -m c
+
+  $ hg prev
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  [1] b
+  $ echo 'b without typo' > b
+  $ hg amend
+  1 new orphan changesets
+  $ hg evolve
+  move:[2] c
+  atop:[3] b
+
+  $ hg up 0
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo d > d; hg add d; hg ci -m d
+  created new head
+  $ hg rebase --hidden --config experimental.evolution.allowdivergence=True -s 1 -d 5
+  rebasing 1:d420a663b65e "b"
+  rebasing 2:49f182e7a6cc "c"
+  4 new content-divergent changesets
+  $ hg log -G -v --patch
+  *  changeset:   7:ef4885dea3da
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  instability: content-divergent
+  |  files:       c
+  |  description:
+  |  c
+  |
+  |
+  |  diff -r fe788ccf5416 -r ef4885dea3da c
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,1 @@
+  |  +c
+  |
+  *  changeset:   6:fe788ccf5416
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  instability: content-divergent
+  |  files:       b
+  |  description:
+  |  b
+  |
+  |
+  |  diff -r 980f7dc84c29 -r fe788ccf5416 b
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,1 @@
+  |  +b with typo
+  |
+  @  changeset:   5:980f7dc84c29
+  |  parent:      0:cb9a9f314b8b
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  files:       d
+  |  description:
+  |  d
+  |
+  |
+  |  diff -r cb9a9f314b8b -r 980f7dc84c29 d
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/d	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,1 @@
+  |  +d
+  |
+  | *  changeset:   4:fef59171875e
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  instability: content-divergent
+  | |  files:       c
+  | |  description:
+  | |  c
+  | |
+  | |
+  | |  diff -r 5b2d00df9c4e -r fef59171875e c
+  | |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  | |  +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+  | |  @@ -0,0 +1,1 @@
+  | |  +c
+  | |
+  | *  changeset:   3:5b2d00df9c4e
+  |/   parent:      0:cb9a9f314b8b
+  |    user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    instability: content-divergent
+  |    files:       b
+  |    description:
+  |    b
+  |
+  |
+  |    diff -r cb9a9f314b8b -r 5b2d00df9c4e b
+  |    --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |    +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+  |    @@ -0,0 +1,1 @@
+  |    +b without typo
+  |
+  o  changeset:   0:cb9a9f314b8b
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     files:       a
+     description:
+     a
+  
+  
+     diff -r 000000000000 -r cb9a9f314b8b a
+     --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/a	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +a
+  
+
+  $ hg evolve --content-divergent
+  merge:[6] b
+  with: [3] b
+  base: [1] b
+  rebasing "other" content-divergent changeset 5b2d00df9c4e on 980f7dc84c29
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  merge:[7] c
+  with: [4] c
+  base: [2] c
+  rebasing "other" content-divergent changeset fef59171875e on fe788ccf5416
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Expected result:
+Changeset with description "b" only adds file "b" with content "b without typo".
+Changeset with description "c" only adds file "c" with content "c".
+
+Actual result:
+In addition, changeset with description "c" also changes the content of file
+"b" from "b without typo" to "b with typo" (undoing the changes introduced by the amend).
+  $ hg glog -l2 -p
+  o  11:344b9ba79c10 c
+  |   () [default] draftdiff -r 0999c349998d -r 344b9ba79c10 b
+  |  --- a/b	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -1,1 +1,1 @@
+  |  -b without typo
+  |  +b with typo
+  |  diff -r 0999c349998d -r 344b9ba79c10 c
+  |  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  |  +++ b/c	Thu Jan 01 00:00:00 1970 +0000
+  |  @@ -0,0 +1,1 @@
+  |  +c
+  |
+  o  9:0999c349998d b
+  |   () [default] draftdiff -r 980f7dc84c29 -r 0999c349998d b
+  ~  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+     +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+     @@ -0,0 +1,1 @@
+     +b without typo
+  
+  $ cd ..