comparison tests/test-rename-dir-merge.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 73d4f6551798
comparison
equal deleted inserted replaced
23443:3b653c2fd6ba 23444:88629daa727b
103 $ hg ci -m "4 merge 1+2" 103 $ hg ci -m "4 merge 1+2"
104 created new head 104 created new head
105 $ hg debugrename b/c 105 $ hg debugrename b/c
106 b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88 (glob) 106 b/c renamed from a/c:354ae8da6e890359ef49ade27b68bbc361f3ca88 (glob)
107 107
108 Local directory rename with conflicting file added in remote source directory
109 and untracked in local target directory.
110
111 BROKEN: the uncommitted file is overwritten; we should abort
112
113 $ hg co -qC 1
114 $ echo local > b/c
115 $ hg merge 2
116 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
117 (branch merge, don't forget to commit)
118 $ hg st -C
119 A b/c
120 a/c
121 ? a/d
122 $ cat b/c
123 baz
124
125 Local directory rename with conflicting file added in remote source directory
126 and committed in local target directory.
127
128 BROKEN: the local file is overwritten; it should be merged
129
130 $ hg co -qC 1
131 $ echo local > b/c
132 $ hg add b/c
133 $ hg commit -qm 'new file in target directory'
134 $ hg merge 2
135 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
136 (branch merge, don't forget to commit)
137 $ hg st -C
138 A b/c
139 a/c
140 ? a/d
141 $ cat b/c
142 baz
108 143
109 Second scenario with two repos: 144 Second scenario with two repos:
110 145
111 $ cd .. 146 $ cd ..
112 $ hg init r1 147 $ hg init r1