comparison mercurial/merge.py @ 16794:98687cdddcb1

merge: warn about file deleted in one branch and renamed in other (issue3074) For divergent renames the following message is printed during merge: note: possible conflict - file was renamed multiple times to: newfile file2 When a file is renamed in one branch and deleted in the other, the file still exists after a merge. With this change a similar message is printed for mv+rm: note: possible conflict - file was deleted and renamed to: newfile
author Thomas Arendsen Hein <thomas@intevation.de>
date Wed, 23 May 2012 20:50:16 +0200
parents e7bf09acd410
children ce7bc04d863b
comparison
equal deleted inserted replaced
16793:9cbc44a6600e 16794:98687cdddcb1
196 if overwrite: 196 if overwrite:
197 pa = p1 197 pa = p1
198 elif pa == p2: # backwards 198 elif pa == p2: # backwards
199 pa = p1.p1() 199 pa = p1.p1()
200 elif pa and repo.ui.configbool("merge", "followcopies", True): 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 for of, fl in diverge.iteritems(): 202 for of, fl in diverge.iteritems():
203 act("divergent renames", "dr", of, fl) 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 repo.ui.note(_("resolving manifests\n")) 207 repo.ui.note(_("resolving manifests\n"))
206 repo.ui.debug(" overwrite: %s, partial: %s\n" 208 repo.ui.debug(" overwrite: %s, partial: %s\n"
207 % (bool(overwrite), bool(partial))) 209 % (bool(overwrite), bool(partial)))
208 repo.ui.debug(" ancestor: %s, local: %s, remote: %s\n" % (pa, p1, p2)) 210 repo.ui.debug(" ancestor: %s, local: %s, remote: %s\n" % (pa, p1, p2))
407 fl = a[2] 409 fl = a[2]
408 repo.ui.warn(_("note: possible conflict - %s was renamed " 410 repo.ui.warn(_("note: possible conflict - %s was renamed "
409 "multiple times to:\n") % f) 411 "multiple times to:\n") % f)
410 for nf in fl: 412 for nf in fl:
411 repo.ui.warn(" %s\n" % nf) 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 elif m == "e": # exec 420 elif m == "e": # exec
413 flags = a[2] 421 flags = a[2]
414 repo.wopener.audit(f) 422 repo.wopener.audit(f)
415 util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags) 423 util.setflags(repo.wjoin(f), 'l' in flags, 'x' in flags)
416 ms.commit() 424 ms.commit()