comparison mercurial/merge.py @ 13158:9e7e24052745

merge: fast-forward merge with descendant issue2538 gives a case where a changeset is merged with its child (which is on another branch), and to my surprise the result is a real merge with two parents, not just a "fast forward" "merge" with only the child as parent. That is essentially the same as issue619. Is the existing behaviour as intended and correct? Or is the following fix correct? Some extra "created new head" pops up with this fix, but it seems to me like they could be considered correct. The old branch head has been superseeded by changes on the other branch, and when the changes on the other branch is merged back to the branch it will introduce a new head not directly related to the previous branch head. (I guess the intention with existing behaviour could be to ensure that the changesets on the branch are directly connected and that no new heads pops up on merges.)
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 07 Dec 2010 03:29:21 +0100
parents 62c8f7691bc3
children 115a9760c382
comparison
equal deleted inserted replaced
13157:82f840109f76 13158:9e7e24052745
522 _checkcollision(p2) 522 _checkcollision(p2)
523 action += _forgetremoved(wc, p2, branchmerge) 523 action += _forgetremoved(wc, p2, branchmerge)
524 action += manifestmerge(repo, wc, p2, pa, overwrite, partial) 524 action += manifestmerge(repo, wc, p2, pa, overwrite, partial)
525 525
526 ### apply phase 526 ### apply phase
527 if not branchmerge: # just jump to the new rev 527 if not branchmerge or fastforward: # just jump to the new rev
528 fp1, fp2, xp1, xp2 = fp2, nullid, xp2, '' 528 fp1, fp2, xp1, xp2 = fp2, nullid, xp2, ''
529 if not partial: 529 if not partial:
530 repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2) 530 repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2)
531 531
532 stats = applyupdates(repo, action, wc, p2, pa) 532 stats = applyupdates(repo, action, wc, p2, pa)
533 533
534 if not partial: 534 if not partial:
535 repo.dirstate.setparents(fp1, fp2) 535 repo.dirstate.setparents(fp1, fp2)
536 recordupdates(repo, action, branchmerge) 536 recordupdates(repo, action, branchmerge and not fastforward)
537 if not branchmerge and not fastforward: 537 if not branchmerge and not fastforward:
538 repo.dirstate.setbranch(p2.branch()) 538 repo.dirstate.setbranch(p2.branch())
539 finally: 539 finally:
540 wlock.release() 540 wlock.release()
541 541