view tests/test-update-reverse.t @ 23444:88629daa727b

merge: demonstrate that directory renames can lose local file content When a directory has been renamed on the local branch and a file has been added in the old location on a remote branch, we move that new file to the new location. Unfortunately, if there is already a file there, we overwrite it with the contents from the remote branch. For untracked local files, we should probably abort, and for tracked local files, we should merge the contents. To start with, let's add a test to demonstrate the breakage. Also note that while files merged in from a remote branch are normally (and unintuitively) reported as modified, these files are reported as added.
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 02 Dec 2014 13:28:07 -0800
parents cb15835456cb
children bd625cd4e5e7
line wrap: on
line source

  $ hg init

  $ touch a
  $ hg add a
  $ hg commit -m "Added a"

  $ touch main
  $ hg add main
  $ hg commit -m "Added main"
  $ hg checkout 0
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved

'main' should be gone:

  $ ls
  a

  $ touch side1
  $ hg add side1
  $ hg commit -m "Added side1"
  created new head
  $ touch side2
  $ hg add side2
  $ hg commit -m "Added side2"

  $ hg log
  changeset:   3:91ebc10ed028
  tag:         tip
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     Added side2
  
  changeset:   2:b932d7dbb1e1
  parent:      0:c2eda428b523
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     Added side1
  
  changeset:   1:71a760306caf
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     Added main
  
  changeset:   0:c2eda428b523
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     Added a
  

  $ hg heads
  changeset:   3:91ebc10ed028
  tag:         tip
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     Added side2
  
  changeset:   1:71a760306caf
  user:        test
  date:        Thu Jan 01 00:00:00 1970 +0000
  summary:     Added main
  
  $ ls
  a
  side1
  side2

  $ hg update --debug -C 1
  resolving manifests
   branchmerge: False, force: True, partial: False
   ancestor: 91ebc10ed028+, local: 91ebc10ed028+, remote: 71a760306caf
   side1: other deleted -> r
  removing side1
   side2: other deleted -> r
  removing side2
  updating: side2 2/3 files (66.67%)
   main: remote created -> g
  getting main
  updating: main 3/3 files (100.00%)
  1 files updated, 0 files merged, 2 files removed, 0 files unresolved

  $ ls
  a
  main