mercurial/merge.py
changeset 4904 6fd953d5faea
parent 4884 931f901ab811
child 4915 97b734fb9c6f
equal deleted inserted replaced
4903:81078e177266 4904:6fd953d5faea
   445 
   445 
   446     for a in action:
   446     for a in action:
   447         f, m = a[:2]
   447         f, m = a[:2]
   448         if m == "r": # remove
   448         if m == "r": # remove
   449             if branchmerge:
   449             if branchmerge:
   450                 repo.dirstate.update([f], 'r')
   450                 repo.dirstate.remove(f)
   451             else:
   451             else:
   452                 repo.dirstate.forget([f])
   452                 repo.dirstate.forget(f)
   453         elif m == "f": # forget
   453         elif m == "f": # forget
   454             repo.dirstate.forget([f])
   454             repo.dirstate.forget(f)
   455         elif m == "g": # get
   455         elif m == "g": # get
   456             if branchmerge:
   456             if branchmerge:
   457                 repo.dirstate.update([f], 'n', st_mtime=-1)
   457                 repo.dirstate.normaldirty(f)
   458             else:
   458             else:
   459                 repo.dirstate.update([f], 'n')
   459                 repo.dirstate.normal(f)
   460         elif m == "m": # merge
   460         elif m == "m": # merge
   461             f2, fd, flag, move = a[2:]
   461             f2, fd, flag, move = a[2:]
   462             if branchmerge:
   462             if branchmerge:
   463                 # We've done a branch merge, mark this file as merged
   463                 # We've done a branch merge, mark this file as merged
   464                 # so that we properly record the merger later
   464                 # so that we properly record the merger later
   465                 repo.dirstate.update([fd], 'm')
   465                 repo.dirstate.merge(fd)
   466                 if f != f2: # copy/rename
   466                 if f != f2: # copy/rename
   467                     if move:
   467                     if move:
   468                         repo.dirstate.update([f], 'r')
   468                         repo.dirstate.remove(f)
   469                     if f != fd:
   469                     if f != fd:
   470                         repo.dirstate.copy(f, fd)
   470                         repo.dirstate.copy(f, fd)
   471                     else:
   471                     else:
   472                         repo.dirstate.copy(f2, fd)
   472                         repo.dirstate.copy(f2, fd)
   473             else:
   473             else:
   474                 # We've update-merged a locally modified file, so
   474                 # We've update-merged a locally modified file, so
   475                 # we set the dirstate to emulate a normal checkout
   475                 # we set the dirstate to emulate a normal checkout
   476                 # of that file some time in the past. Thus our
   476                 # of that file some time in the past. Thus our
   477                 # merge will appear as a normal local file
   477                 # merge will appear as a normal local file
   478                 # modification.
   478                 # modification.
   479                 repo.dirstate.update([fd], 'n', st_size=-1, st_mtime=-1)
   479                 repo.dirstate.normaldirty(fd)
   480                 if move:
   480                 if move:
   481                     repo.dirstate.forget([f])
   481                     repo.dirstate.forget(f)
   482         elif m == "d": # directory rename
   482         elif m == "d": # directory rename
   483             f2, fd, flag = a[2:]
   483             f2, fd, flag = a[2:]
   484             if not f2 and f not in repo.dirstate:
   484             if not f2 and f not in repo.dirstate:
   485                 # untracked file moved
   485                 # untracked file moved
   486                 continue
   486                 continue
   487             if branchmerge:
   487             if branchmerge:
   488                 repo.dirstate.update([fd], 'a')
   488                 repo.dirstate.add(fd)
   489                 if f:
   489                 if f:
   490                     repo.dirstate.update([f], 'r')
   490                     repo.dirstate.remove(f)
   491                     repo.dirstate.copy(f, fd)
   491                     repo.dirstate.copy(f, fd)
   492                 if f2:
   492                 if f2:
   493                     repo.dirstate.copy(f2, fd)
   493                     repo.dirstate.copy(f2, fd)
   494             else:
   494             else:
   495                 repo.dirstate.update([fd], 'n')
   495                 repo.dirstate.normal(fd)
   496                 if f:
   496                 if f:
   497                     repo.dirstate.forget([f])
   497                     repo.dirstate.forget(f)
   498 
   498 
   499 def update(repo, node, branchmerge, force, partial, wlock):
   499 def update(repo, node, branchmerge, force, partial, wlock):
   500     """
   500     """
   501     Perform a merge between the working directory and the given node
   501     Perform a merge between the working directory and the given node
   502 
   502