comparison mercurial/merge.py @ 44939:818b4f19ef23

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
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 05 Jun 2020 11:10:33 -0700
parents b7808443ed6a
children d1471dbbdd63
comparison
equal deleted inserted replaced
44938:3d409f4ff46b 44939:818b4f19ef23
458 # Rename all local conflicting files that have not been deleted. 458 # Rename all local conflicting files that have not been deleted.
459 for p in localconflicts: 459 for p in localconflicts:
460 if p not in deletedfiles: 460 if p not in deletedfiles:
461 ctxname = bytes(wctx).rstrip(b'+') 461 ctxname = bytes(wctx).rstrip(b'+')
462 pnew = util.safename(p, ctxname, wctx, set(actions.keys())) 462 pnew = util.safename(p, ctxname, wctx, set(actions.keys()))
463 porig = wctx[p].copysource() or p
463 actions[pnew] = ( 464 actions[pnew] = (
464 mergestatemod.ACTION_PATH_CONFLICT_RESOLVE, 465 mergestatemod.ACTION_PATH_CONFLICT_RESOLVE,
465 (p,), 466 (p, porig),
466 b'local path conflict', 467 b'local path conflict',
467 ) 468 )
468 actions[p] = ( 469 actions[p] = (
469 mergestatemod.ACTION_PATH_CONFLICT, 470 mergestatemod.ACTION_PATH_CONFLICT,
470 (pnew, b'l'), 471 (pnew, b'l'),
1278 removed = len(actions[mergestatemod.ACTION_REMOVE]) 1279 removed = len(actions[mergestatemod.ACTION_REMOVE])
1279 1280
1280 # resolve path conflicts (must come before getting) 1281 # resolve path conflicts (must come before getting)
1281 for f, args, msg in actions[mergestatemod.ACTION_PATH_CONFLICT_RESOLVE]: 1282 for f, args, msg in actions[mergestatemod.ACTION_PATH_CONFLICT_RESOLVE]:
1282 repo.ui.debug(b" %s: %s -> pr\n" % (f, msg)) 1283 repo.ui.debug(b" %s: %s -> pr\n" % (f, msg))
1283 (f0,) = args 1284 (f0, origf0) = args
1284 if wctx[f0].lexists(): 1285 if wctx[f0].lexists():
1285 repo.ui.note(_(b"moving %s to %s\n") % (f0, f)) 1286 repo.ui.note(_(b"moving %s to %s\n") % (f0, f))
1286 wctx[f].audit() 1287 wctx[f].audit()
1287 wctx[f].write(wctx.filectx(f0).data(), wctx.filectx(f0).flags()) 1288 wctx[f].write(wctx.filectx(f0).data(), wctx.filectx(f0).flags())
1288 wctx[f0].remove() 1289 wctx[f0].remove()