mercurial/merge.py
branchstable
changeset 11454 9b0406b23be0
parent 11451 51021f4c80b5
child 11466 ad27428c59ce
equal deleted inserted replaced
11453:2ee26044d846 11454:9b0406b23be0
   240     return action
   240     return action
   241 
   241 
   242 def actionkey(a):
   242 def actionkey(a):
   243     return a[1] == 'r' and -1 or 0, a
   243     return a[1] == 'r' and -1 or 0, a
   244 
   244 
   245 def applyupdates(repo, action, wctx, mctx):
   245 def applyupdates(repo, action, wctx, mctx, actx):
   246     "apply the merge action list to the working directory"
   246     """apply the merge action list to the working directory
       
   247 
       
   248     wctx is the working copy context
       
   249     mctx is the context to be merged into the working copy
       
   250     actx is the context of the common ancestor
       
   251     """
   247 
   252 
   248     updated, merged, removed, unresolved = 0, 0, 0, 0
   253     updated, merged, removed, unresolved = 0, 0, 0, 0
   249     ms = mergestate(repo)
   254     ms = mergestate(repo)
   250     ms.reset(wctx.parents()[0].node())
   255     ms.reset(wctx.parents()[0].node())
   251     moves = []
   256     moves = []
   261             if f == '.hgsubstate': # merged internally
   266             if f == '.hgsubstate': # merged internally
   262                 continue
   267                 continue
   263             repo.ui.debug("preserving %s for resolve of %s\n" % (f, fd))
   268             repo.ui.debug("preserving %s for resolve of %s\n" % (f, fd))
   264             fcl = wctx[f]
   269             fcl = wctx[f]
   265             fco = mctx[f2]
   270             fco = mctx[f2]
   266             fca = fcl.ancestor(fco) or repo.filectx(f, fileid=nullrev)
   271             fca = fcl.ancestor(fco, actx) or repo.filectx(f, fileid=nullrev)
   267             ms.add(fcl, fco, fca, fd, flags)
   272             ms.add(fcl, fco, fca, fd, flags)
   268             if f != fd and move:
   273             if f != fd and move:
   269                 moves.append(f)
   274                 moves.append(f)
   270 
   275 
   271     # remove renamed files after safely stored
   276     # remove renamed files after safely stored
   503         if not branchmerge: # just jump to the new rev
   508         if not branchmerge: # just jump to the new rev
   504             fp1, fp2, xp1, xp2 = fp2, nullid, xp2, ''
   509             fp1, fp2, xp1, xp2 = fp2, nullid, xp2, ''
   505         if not partial:
   510         if not partial:
   506             repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2)
   511             repo.hook('preupdate', throw=True, parent1=xp1, parent2=xp2)
   507 
   512 
   508         stats = applyupdates(repo, action, wc, p2)
   513         stats = applyupdates(repo, action, wc, p2, pa)
   509 
   514 
   510         if not partial:
   515         if not partial:
   511             repo.dirstate.setparents(fp1, fp2)
   516             repo.dirstate.setparents(fp1, fp2)
   512             recordupdates(repo, action, branchmerge)
   517             recordupdates(repo, action, branchmerge)
   513             if not branchmerge and not fastforward:
   518             if not branchmerge and not fastforward: