diff 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
line wrap: on
line diff
--- a/mercurial/merge.py	Wed Dec 08 22:14:18 2010 -0600
+++ b/mercurial/merge.py	Tue Dec 07 03:29:21 2010 +0100
@@ -524,7 +524,7 @@
         action += manifestmerge(repo, wc, p2, pa, overwrite, partial)
 
         ### apply phase
-        if not branchmerge: # just jump to the new rev
+        if not branchmerge or fastforward: # just jump to the new rev
             fp1, fp2, xp1, xp2 = fp2, nullid, xp2, ''
         if not partial:
             repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2)
@@ -533,7 +533,7 @@
 
         if not partial:
             repo.dirstate.setparents(fp1, fp2)
-            recordupdates(repo, action, branchmerge)
+            recordupdates(repo, action, branchmerge and not fastforward)
             if not branchmerge and not fastforward:
                 repo.dirstate.setbranch(p2.branch())
     finally: