mercurial/merge.py
changeset 13561 0ab0ceefddf2
parent 13550 1792b8a9422b
child 13728 15d1db2abfcb
equal deleted inserted replaced
13560:a2734c8322ac 13561:0ab0ceefddf2
   491         overwrite = force and not branchmerge
   491         overwrite = force and not branchmerge
   492         pl = wc.parents()
   492         pl = wc.parents()
   493         p1, p2 = pl[0], repo[node]
   493         p1, p2 = pl[0], repo[node]
   494         pa = p1.ancestor(p2)
   494         pa = p1.ancestor(p2)
   495         fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2)
   495         fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2)
   496         fastforward = False
       
   497 
   496 
   498         ### check phase
   497         ### check phase
   499         if not overwrite and len(pl) > 1:
   498         if not overwrite and len(pl) > 1:
   500             raise util.Abort(_("outstanding uncommitted merges"))
   499             raise util.Abort(_("outstanding uncommitted merges"))
   501         if branchmerge:
   500         if branchmerge:
   502             if pa == p2:
   501             if pa == p2:
   503                 raise util.Abort(_("merging with a working directory ancestor"
   502                 raise util.Abort(_("merging with a working directory ancestor"
   504                                    " has no effect"))
   503                                    " has no effect"))
   505             elif pa == p1:
   504             elif pa == p1:
   506                 if p1.branch() != p2.branch():
   505                 if p1.branch() == p2.branch():
   507                     fastforward = True
       
   508                 else:
       
   509                     raise util.Abort(_("nothing to merge (use 'hg update'"
   506                     raise util.Abort(_("nothing to merge (use 'hg update'"
   510                                        " or check 'hg heads')"))
   507                                        " or check 'hg heads')"))
   511             if not force and (wc.files() or wc.deleted()):
   508             if not force and (wc.files() or wc.deleted()):
   512                 raise util.Abort(_("outstanding uncommitted changes "
   509                 raise util.Abort(_("outstanding uncommitted changes "
   513                                    "(use 'hg status' to list changes)"))
   510                                    "(use 'hg status' to list changes)"))
   548         stats = applyupdates(repo, action, wc, p2, pa, overwrite)
   545         stats = applyupdates(repo, action, wc, p2, pa, overwrite)
   549 
   546 
   550         if not partial:
   547         if not partial:
   551             repo.dirstate.setparents(fp1, fp2)
   548             repo.dirstate.setparents(fp1, fp2)
   552             recordupdates(repo, action, branchmerge)
   549             recordupdates(repo, action, branchmerge)
   553             if not branchmerge and not fastforward:
   550             if not branchmerge:
   554                 repo.dirstate.setbranch(p2.branch())
   551                 repo.dirstate.setbranch(p2.branch())
   555     finally:
   552     finally:
   556         wlock.release()
   553         wlock.release()
   557 
   554 
   558     if not partial:
   555     if not partial: