mercurial/merge.py
changeset 3103 22336ad45cf2
parent 3102 36b08cd92fb7
child 3104 e6818b0b8154
equal deleted inserted replaced
3102:36b08cd92fb7 3103:22336ad45cf2
   106                   (overwrite, branchmerge, bool(partial), linear_path))
   106                   (overwrite, branchmerge, bool(partial), linear_path))
   107     repo.ui.debug(_(" ancestor %s local %s remote %s\n") %
   107     repo.ui.debug(_(" ancestor %s local %s remote %s\n") %
   108                   (short(p1), short(p2), short(pa)))
   108                   (short(p1), short(p2), short(pa)))
   109 
   109 
   110     action = []
   110     action = []
   111     forget = []
       
   112 
   111 
   113     # update m1 from working dir
   112     # update m1 from working dir
   114     umap = dict.fromkeys(unknown)
   113     umap = dict.fromkeys(unknown)
   115 
   114 
   116     for i,l in (("a", added), ("m", modified), ("u", unknown)):
   115     for i,l in (("a", added), ("m", modified), ("u", unknown)):
   125         # and if neither the working directory nor the target rev has
   124         # and if neither the working directory nor the target rev has
   126         # the file, then we need to remove it from the dirstate, to
   125         # the file, then we need to remove it from the dirstate, to
   127         # prevent the dirstate from listing the file when it is no
   126         # prevent the dirstate from listing the file when it is no
   128         # longer in the manifest.
   127         # longer in the manifest.
   129         if linear_path and f not in m2:
   128         if linear_path and f not in m2:
   130             forget.append(f)
   129             action.append((f, "f"))
   131 
   130 
   132     if partial:
   131     if partial:
   133         for f in m1.keys():
   132         for f in m1.keys():
   134             if not partial(f): del m1[f]
   133             if not partial(f): del m1[f]
   135         for f in m2.keys():
   134         for f in m2.keys():
   266             updated += 1
   265             updated += 1
   267 
   266 
   268     # update dirstate
   267     # update dirstate
   269     if not partial:
   268     if not partial:
   270         repo.dirstate.setparents(p1, p2)
   269         repo.dirstate.setparents(p1, p2)
   271         repo.dirstate.forget(forget)
       
   272         for a in action:
   270         for a in action:
   273             f, m = a[:2]
   271             f, m = a[:2]
   274             if m == "r": # remove
   272             if m == "r": # remove
   275                 if branchmerge:
   273                 if branchmerge:
   276                     repo.dirstate.update([f], 'r')
   274                     repo.dirstate.update([f], 'r')
   277                 else:
   275                 else:
   278                     repo.dirstate.forget([f])
   276                     repo.dirstate.forget([f])
       
   277             elif m == "f": # forget
       
   278                 repo.dirstate.forget([f])
   279             elif m == "g": # get
   279             elif m == "g": # get
   280                 if branchmerge:
   280                 if branchmerge:
   281                     repo.dirstate.update([f], 'n', st_mtime=-1)
   281                     repo.dirstate.update([f], 'n', st_mtime=-1)
   282                 else:
   282                 else:
   283                     repo.dirstate.update([f], 'n')
   283                     repo.dirstate.update([f], 'n')