# HG changeset patch # User Martin von Zweigbergk # Date 1601913741 25200 # Node ID bf48247af25ab551a380eebce8d4eed768912d84 # Parent fa7f2e1cb5049346676d1218d56ba28556cc796b tests: demonstrate that touch can lose files (issue6416) This commit also includes a test of how copies are handled in the touched merge commit. diff -r fa7f2e1cb504 -r bf48247af25a tests/test-touch.t --- a/tests/test-touch.t Tue Jul 13 16:19:29 2021 -0400 +++ b/tests/test-touch.t Mon Oct 05 09:02:21 2020 -0700 @@ -212,6 +212,115 @@ $ 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 +BROKEN: should be the same as "5" + $ hg status --hidden --change 'max(desc("merge"))' + A right2 +BROKEN: There should be no difference + $ hg status --hidden --rev 'min(desc("merge"))' --rev 'max(desc("merge"))' + R right1 + $ 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 (missing-correct-output !) + $ hg debugpathcopies 'min(desc("right"))' 'max(desc("merge"))' + base -> copy-on-left + right -> merge-copy-right (missing-correct-output !) + $ cd .. + Make sure touch doesn't fail to warn about divergence (issue6107) $ hg init touchdiv