changeset 44477:6f1f4a6f4168

copies-tests: add a case where a file is deleted/added but with a merge This is a case similar to DB/BD, but in this case the other branch updated the file. So an actual merge happens and the two "independant" file history has to be merged. Differential Revision: https://phab.mercurial-scm.org/D8241
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 03 Mar 2020 15:46:28 +0100
parents 890def17d03b
children c8fd21413458
files tests/test-copies-chain-merge.t
diffstat 1 files changed, 98 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-copies-chain-merge.t	Tue Mar 03 12:35:24 2020 +0100
+++ b/tests/test-copies-chain-merge.t	Tue Mar 03 15:46:28 2020 +0100
@@ -347,6 +347,48 @@
   o  0 i-0 initial commit: a b h]
   
 
+Merge:
+- one with change to a file
+- one deleting and recreating the file
+
+  $ hg up 'desc("i-2")'
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo "some update" >> d
+  $ hg commit -m "g-1: update d"
+  created new head
+  $ hg up 'desc("d-2")'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg merge 'desc("g-1")' --tool :union
+  merging d
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'mDGm-0 simple merge - one way'
+  $ hg up 'desc("g-1")'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg merge 'desc("d-2")' --tool :union
+  merging d
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m 'mGDm-0 simple merge - the other way'
+  created new head
+  $ hg log -G --rev '::(desc("mDGm")+desc("mGDm"))'
+  @    27 mGDm-0 simple merge - the other way]
+  |\
+  +---o  26 mDGm-0 simple merge - one way]
+  | |/
+  | o  25 g-1: update d]
+  | |
+  o |  14 d-2 re-add d]
+  | |
+  o |  13 d-1 delete d]
+  |/
+  o  2 i-2: c -move-> d]
+  |
+  o  1 i-1: a -move-> c]
+  |
+  o  0 i-0 initial commit: a b h]
+  
+
 
 Check results
 =============
@@ -499,6 +541,9 @@
        2      15 0bb5445dc4d0 01c2f5eabdc4 b004912a8510
        3      22 c72365ee036f 000000000000 000000000000
        4      23 863d9bc49190 01c2f5eabdc4 c72365ee036f
+       5      25 7bded9d9da1f 01c2f5eabdc4 000000000000
+       6      26 f04cac32d703 b004912a8510 7bded9d9da1f
+       7      27 d7a5eafb9322 7bded9d9da1f b004912a8510
 
 (This `hg log` output if wrong, since no merge actually happened).
 
@@ -655,3 +700,56 @@
   :
   o  0 i-0 initial commit: a b h]
   
+
+Merge:
+- one with change to a file
+- one deleting and recreating the file
+
+Unlike in the 'BD/DB' cases, an actuall merge happened here. So we should
+consider history and rename on both branch of the merge.
+
+  $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mDGm-0")'
+  A d
+    a
+  R a
+  $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mGDm-0")'
+  A d
+    a
+  R a
+  $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mDGm-0")'
+  M d
+  $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mGDm-0")'
+  M d
+  $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mDGm-0")'
+  M d
+  $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mGDm-0")'
+  M d
+
+  $ hg log -Gfr 'desc("mDGm-0")' d
+  o    26 mDGm-0 simple merge - one way]
+  |\
+  | o  25 g-1: update d]
+  | |
+  o |  14 d-2 re-add d]
+  |/
+  o  2 i-2: c -move-> d]
+  |
+  o  1 i-1: a -move-> c]
+  |
+  o  0 i-0 initial commit: a b h]
+  
+
+
+  $ hg log -Gfr 'desc("mDGm-0")' d
+  o    26 mDGm-0 simple merge - one way]
+  |\
+  | o  25 g-1: update d]
+  | |
+  o |  14 d-2 re-add d]
+  |/
+  o  2 i-2: c -move-> d]
+  |
+  o  1 i-1: a -move-> c]
+  |
+  o  0 i-0 initial commit: a b h]
+