Show More
@@ -177,19 +177,22 b' def mergecopies(repo, c1, c2, ca):' | |||
|
177 | 177 | |
|
178 | 178 | "diverge" is a mapping of source name -> list of destination names |
|
179 | 179 | for divergent renames. |
|
180 | ||
|
181 | "renamedelete" is a mapping of source name -> list of destination | |
|
182 | names for files deleted in c1 that were renamed in c2 or vice-versa. | |
|
180 | 183 | """ |
|
181 | 184 | # avoid silly behavior for update from empty dir |
|
182 | 185 | if not c1 or not c2 or c1 == c2: |
|
183 | return {}, {} | |
|
186 | return {}, {}, {} | |
|
184 | 187 | |
|
185 | 188 | # avoid silly behavior for parent -> working dir |
|
186 | 189 | if c2.node() is None and c1.node() == repo.dirstate.p1(): |
|
187 | return repo.dirstate.copies(), {} | |
|
190 | return repo.dirstate.copies(), {}, {} | |
|
188 | 191 | |
|
189 | 192 | limit = _findlimit(repo, c1.rev(), c2.rev()) |
|
190 | 193 | if limit is None: |
|
191 | 194 | # no common ancestor, no copies |
|
192 | return {}, {} | |
|
195 | return {}, {}, {} | |
|
193 | 196 | m1 = c1.manifest() |
|
194 | 197 | m2 = c2.manifest() |
|
195 | 198 | ma = ca.manifest() |
@@ -283,10 +286,15 b' def mergecopies(repo, c1, c2, ca):' | |||
|
283 | 286 | for f in u2: |
|
284 | 287 | checkcopies(f, m2, m1) |
|
285 | 288 | |
|
289 | renamedelete = {} | |
|
286 | 290 | diverge2 = set() |
|
287 | 291 | for of, fl in diverge.items(): |
|
288 | 292 | if len(fl) == 1 or of in c1 or of in c2: |
|
289 | 293 | del diverge[of] # not actually divergent, or not a rename |
|
294 | if of not in c1 and of not in c2: | |
|
295 | # renamed on one side, deleted on the other side, but filter | |
|
296 | # out files that have been renamed and then deleted | |
|
297 | renamedelete[of] = [f for f in fl if f in c1 or f in c2] | |
|
290 | 298 | else: |
|
291 | 299 | diverge2.update(fl) # reverse map for below |
|
292 | 300 | |
@@ -302,7 +310,7 b' def mergecopies(repo, c1, c2, ca):' | |||
|
302 | 310 | del diverge2 |
|
303 | 311 | |
|
304 | 312 | if not fullcopy: |
|
305 | return copy, diverge | |
|
313 | return copy, diverge, renamedelete | |
|
306 | 314 | |
|
307 | 315 | repo.ui.debug(" checking for directory renames\n") |
|
308 | 316 | |
@@ -337,7 +345,7 b' def mergecopies(repo, c1, c2, ca):' | |||
|
337 | 345 | del d1, d2, invalid |
|
338 | 346 | |
|
339 | 347 | if not dirmove: |
|
340 | return copy, diverge | |
|
348 | return copy, diverge, renamedelete | |
|
341 | 349 | |
|
342 | 350 | for d in dirmove: |
|
343 | 351 | repo.ui.debug(" dir %s -> %s\n" % (d, dirmove[d])) |
@@ -354,4 +362,4 b' def mergecopies(repo, c1, c2, ca):' | |||
|
354 | 362 | repo.ui.debug(" file %s -> %s\n" % (f, copy[f])) |
|
355 | 363 | break |
|
356 | 364 | |
|
357 | return copy, diverge | |
|
365 | return copy, diverge, renamedelete |
@@ -198,9 +198,11 b' def manifestmerge(repo, p1, p2, pa, over' | |||
|
198 | 198 | elif pa == p2: # backwards |
|
199 | 199 | pa = p1.p1() |
|
200 | 200 | elif pa and repo.ui.configbool("merge", "followcopies", True): |
|
201 | copy, diverge = copies.mergecopies(repo, p1, p2, pa) | |
|
201 | copy, diverge, renamedelete = copies.mergecopies(repo, p1, p2, pa) | |
|
202 | 202 | for of, fl in diverge.iteritems(): |
|
203 | 203 | act("divergent renames", "dr", of, fl) |
|
204 | for of, fl in renamedelete.iteritems(): | |
|
205 | act("rename and delete", "rd", of, fl) | |
|
204 | 206 | |
|
205 | 207 | repo.ui.note(_("resolving manifests\n")) |
|
206 | 208 | repo.ui.debug(" overwrite: %s, partial: %s\n" |
@@ -409,6 +411,12 b' def applyupdates(repo, action, wctx, mct' | |||
|
409 | 411 | "multiple times to:\n") % f) |
|
410 | 412 | for nf in fl: |
|
411 | 413 | repo.ui.warn(" %s\n" % nf) |
|
414 | elif m == "rd": # rename and delete | |
|
415 | fl = a[2] | |
|
416 | repo.ui.warn(_("note: possible conflict - %s was deleted " | |
|
417 | "and renamed to:\n") % f) | |
|
418 | for nf in fl: | |
|
419 | repo.ui.warn(" %s\n" % nf) | |
|
412 | 420 | elif m == "e": # exec |
|
413 | 421 | flags = a[2] |
|
414 | 422 | repo.wopener.audit(f) |
@@ -156,3 +156,26 b' Check for issue2089' | |||
|
156 | 156 | c2 |
|
157 | 157 | |
|
158 | 158 | $ cd .. |
|
159 | ||
|
160 | Check for issue3074 | |
|
161 | ||
|
162 | $ hg init repo3074 | |
|
163 | $ cd repo3074 | |
|
164 | $ echo foo > file | |
|
165 | $ hg add file | |
|
166 | $ hg commit -m "added file" | |
|
167 | $ hg mv file newfile | |
|
168 | $ hg commit -m "renamed file" | |
|
169 | $ hg update 0 | |
|
170 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
|
171 | $ hg rm file | |
|
172 | $ hg commit -m "deleted file" | |
|
173 | created new head | |
|
174 | $ hg merge | |
|
175 | note: possible conflict - file was deleted and renamed to: | |
|
176 | newfile | |
|
177 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
178 | (branch merge, don't forget to commit) | |
|
179 | $ hg status | |
|
180 | M newfile | |
|
181 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now