diff tests/test-touch.t @ 5987:e97fbded40a5

branching: merge stable into default
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 06 Aug 2021 00:04:46 +0200
parents 65d4e47d7f26 4a09e95d29c9
children 1a13ac9ef30a
line wrap: on
line diff
--- a/tests/test-touch.t	Sat Jun 19 22:13:13 2021 +0300
+++ b/tests/test-touch.t	Fri Aug 06 00:04:46 2021 +0200
@@ -212,6 +212,113 @@
 
   $ cd ..
 
+Check that touching a merge commit doesn't lose file changes (issue 6416)
+
+  $ hg init issue-6416
+  $ cd issue-6416
+  $ echo base > base
+  $ hg ci -Aqm base
+  $ echo left1 > left1
+  $ hg ci -Aqm left1
+  $ echo left2 > left2
+  $ hg ci -Aqm left2
+  $ hg up 0 -q
+  $ echo right1 > right1
+  $ hg ci -Aqm right1
+  $ echo right2 > right2
+  $ hg ci -Aqm right2
+  $ hg up 2 -q
+  $ hg merge 4 -q
+  $ hg ci -m merge
+  $ hg touch tip
+  $ hg glog --hidden
+  @    6: merge
+  |\
+  +---x  5: merge
+  | |/
+  | o  4: right2
+  | |
+  | o  3: right1
+  | |
+  o |  2: left2
+  | |
+  o |  1: left1
+  |/
+  o  0: base
+  
+  $ hg glog --hidden --rev 'min(desc("merge"))' --rev 'max(desc("merge"))'
+  @    6: merge
+  |\
+  ~ ~
+  x    5: merge
+  |\
+  ~ ~
+  $ hg status --hidden --change 'min(desc("merge"))'
+  A right1
+  A right2
+  $ hg status --hidden --change 'max(desc("merge"))'
+  A right1
+  A right2
+  $ hg status --hidden --rev 'min(desc("merge"))' --rev 'max(desc("merge"))'
+  $ cd ..
+
+Check that touching a merge commit doesn't lose copies
+
+  $ hg init merge-copies
+  $ cd merge-copies
+  $ echo base > base
+  $ hg ci -Aqm base
+  $ echo left > left
+  $ hg cp base copy-on-left
+  $ hg ci -Aqm left
+  $ hg up 0 -q
+  $ echo right > right
+  $ hg cp base copy-on-right
+  $ hg ci -Aqm right
+  $ hg up 1 -q
+  $ hg merge 2 -q
+  $ hg cp left merge-copy-left
+  $ hg cp right merge-copy-right
+  $ hg ci -m merge
+  $ hg touch tip
+  $ hg glog --hidden
+  @    4: merge
+  |\
+  +---x  3: merge
+  | |/
+  | o  2: right
+  | |
+  o |  1: left
+  |/
+  o  0: base
+  
+  $ hg glog --hidden --rev 'min(desc("merge"))' --rev 'max(desc("merge"))'
+  @    4: merge
+  |\
+  ~ ~
+  x    3: merge
+  |\
+  ~ ~
+  $ hg debugpathcopies 'min(desc("base"))' 'min(desc("merge"))'
+  base -> copy-on-left
+  base -> copy-on-right
+  $ hg debugpathcopies 'min(desc("base"))' 'max(desc("merge"))'
+  base -> copy-on-left
+  base -> copy-on-right
+  $ hg debugpathcopies 'min(desc("left"))' 'min(desc("merge"))'
+  base -> copy-on-right
+  left -> merge-copy-left
+  $ hg debugpathcopies 'min(desc("left"))' 'max(desc("merge"))'
+  base -> copy-on-right
+  left -> merge-copy-left
+  $ hg debugpathcopies 'min(desc("right"))' 'min(desc("merge"))'
+  base -> copy-on-left
+  right -> merge-copy-right
+  $ hg debugpathcopies 'min(desc("right"))' 'max(desc("merge"))'
+  base -> copy-on-left
+  right -> merge-copy-right
+  $ cd ..
+
 Make sure touch doesn't fail to warn about divergence (issue6107)
 
   $ hg init touchdiv
@@ -236,3 +343,20 @@
   1 new content-divergent changesets
 
   $ cd ..
+
+Touch preserves copies
+
+  $ hg init copies
+  $ cd copies
+  $ echo a > a
+  $ hg ci -Aqm a
+  $ hg cp a b
+  $ hg ci -Aqm 'copy a to b'
+  $ hg status --copies --change .
+  A b
+    a
+  $ hg touch
+  $ hg status --copies --change .
+  A b
+    a
+  $ cd ..