# HG changeset patch # User Martin von Zweigbergk # Date 1591380633 25200 # Node ID 818b4f19ef23258bf2b4373961f55a769ab4b3da # Parent 3d409f4ff46bf0210a6ba3943e01f8830a2af4db merge: move an inspection of the dirstate from record to calculate phase The intent is clearly to have `calculateupdates()` figure out what actions need to be taken and `recordupdates()` to make necessary modifications to the dirstate. However, in the `ACTION_PATH_CONFLICT_RESOLVE` case, there was one little inspection of copy information done in `recordupdates()`. This patch moves that to `calculateupdates()`. That will help with the next patch, which makes `merge.update()` work better with `overlayworkingctx` (copies should be recorded there too, even though we skip the `recordupdates()` step). Differential Revision: https://phab.mercurial-scm.org/D8615 diff -r 3d409f4ff46b -r 818b4f19ef23 mercurial/merge.py --- a/mercurial/merge.py Sat Jun 06 19:15:11 2020 +0800 +++ b/mercurial/merge.py Fri Jun 05 11:10:33 2020 -0700 @@ -460,9 +460,10 @@ if p not in deletedfiles: ctxname = bytes(wctx).rstrip(b'+') pnew = util.safename(p, ctxname, wctx, set(actions.keys())) + porig = wctx[p].copysource() or p actions[pnew] = ( mergestatemod.ACTION_PATH_CONFLICT_RESOLVE, - (p,), + (p, porig), b'local path conflict', ) actions[p] = ( @@ -1280,7 +1281,7 @@ # resolve path conflicts (must come before getting) for f, args, msg in actions[mergestatemod.ACTION_PATH_CONFLICT_RESOLVE]: repo.ui.debug(b" %s: %s -> pr\n" % (f, msg)) - (f0,) = args + (f0, origf0) = args if wctx[f0].lexists(): repo.ui.note(_(b"moving %s to %s\n") % (f0, f)) wctx[f].audit() diff -r 3d409f4ff46b -r 818b4f19ef23 mercurial/mergestate.py --- a/mercurial/mergestate.py Sat Jun 06 19:15:11 2020 +0800 +++ b/mercurial/mergestate.py Fri Jun 05 11:10:33 2020 -0700 @@ -769,8 +769,7 @@ # resolve path conflicts for f, args, msg in actions.get(ACTION_PATH_CONFLICT_RESOLVE, []): - (f0,) = args - origf0 = repo.dirstate.copied(f0) or f0 + (f0, origf0) = args repo.dirstate.add(f) repo.dirstate.copy(origf0, f) if f0 == origf0: