mercurial/merge.py
changeset 45286 00e9c5edcd58
parent 45285 e7196f1da2b1
child 45287 4ad6c4e9e35f
equal deleted inserted replaced
45285:e7196f1da2b1 45286:00e9c5edcd58
   957 
   957 
   958     mresult.updatevalues(diverge, renamedelete, commitinfo)
   958     mresult.updatevalues(diverge, renamedelete, commitinfo)
   959     return mresult
   959     return mresult
   960 
   960 
   961 
   961 
   962 def _resolvetrivial(repo, wctx, mctx, ancestor, actions):
   962 def _resolvetrivial(repo, wctx, mctx, ancestor, mresult):
   963     """Resolves false conflicts where the nodeid changed but the content
   963     """Resolves false conflicts where the nodeid changed but the content
   964        remained the same."""
   964        remained the same."""
   965     # We force a copy of actions.items() because we're going to mutate
   965     # We force a copy of actions.items() because we're going to mutate
   966     # actions as we resolve trivial conflicts.
   966     # actions as we resolve trivial conflicts.
   967     for f, (m, args, msg) in list(actions.items()):
   967     for f, (m, args, msg) in list(mresult.actions.items()):
   968         if (
   968         if (
   969             m == mergestatemod.ACTION_CHANGED_DELETED
   969             m == mergestatemod.ACTION_CHANGED_DELETED
   970             and f in ancestor
   970             and f in ancestor
   971             and not wctx[f].cmp(ancestor[f])
   971             and not wctx[f].cmp(ancestor[f])
   972         ):
   972         ):
   973             # local did change but ended up with same content
   973             # local did change but ended up with same content
   974             actions[f] = mergestatemod.ACTION_REMOVE, None, b'prompt same'
   974             mresult.addfile(
       
   975                 f, mergestatemod.ACTION_REMOVE, None, b'prompt same'
       
   976             )
   975         elif (
   977         elif (
   976             m == mergestatemod.ACTION_DELETED_CHANGED
   978             m == mergestatemod.ACTION_DELETED_CHANGED
   977             and f in ancestor
   979             and f in ancestor
   978             and not mctx[f].cmp(ancestor[f])
   980             and not mctx[f].cmp(ancestor[f])
   979         ):
   981         ):
   980             # remote did change but ended up with same content
   982             # remote did change but ended up with same content
   981             del actions[f]  # don't get = keep local deleted
   983             mresult.removefile(f)  # don't get = keep local deleted
   982 
   984 
   983 
   985 
   984 def calculateupdates(
   986 def calculateupdates(
   985     repo,
   987     repo,
   986     wctx,
   988     wctx,
  1125         mresult.actions.update(fractions)
  1127         mresult.actions.update(fractions)
  1126 
  1128 
  1127     prunedactions = sparse.filterupdatesactions(
  1129     prunedactions = sparse.filterupdatesactions(
  1128         repo, wctx, mctx, branchmerge, mresult.actions
  1130         repo, wctx, mctx, branchmerge, mresult.actions
  1129     )
  1131     )
  1130     _resolvetrivial(repo, wctx, mctx, ancestors[0], mresult.actions)
  1132     _resolvetrivial(repo, wctx, mctx, ancestors[0], mresult)
  1131 
  1133 
  1132     mresult.setactions(prunedactions)
  1134     mresult.setactions(prunedactions)
  1133     return mresult
  1135     return mresult
  1134 
  1136 
  1135 
  1137