# HG changeset patch # User Pierre-Yves David # Date 1600120062 -7200 # Node ID 64a4b85c4a005d26497683f1b2472ddedc20b90c # Parent ebc14a2ad23d128f1bfb3ba9b489e39a6d91701a salvaged: record salvaged in ChangingFiles at commit time The new code is a simple but effective way to detect this information. We might be able to move it inside the various conditionnal above, but I want to focus on simplicity until we have a full working stack. It is worth noting that if we record the information in the ChangingFiles object, it is not persisted yet. This will comes with later changesets. Differential Revision: https://phab.mercurial-scm.org/D9120 diff -r ebc14a2ad23d -r 64a4b85c4a00 mercurial/commit.py --- a/mercurial/commit.py Mon Sep 14 23:46:38 2020 +0200 +++ b/mercurial/commit.py Mon Sep 14 23:47:42 2020 +0200 @@ -140,6 +140,19 @@ files.update_copies_from_p1(ctx.p1copies()) files.update_copies_from_p2(ctx.p2copies()) + copy_sd = ctx.repo().filecopiesmode == b'changeset-sidedata' + if copy_sd and len(ctx.parents()) > 1: + # XXX this `mergestate.read` could be duplicated with a the merge state + # reading in _process_files So we could refactor further to reuse it in + # some cases. + ms = mergestate.mergestate.read(repo) + if ms.active(): + for fname in sorted(ms._stateextras.keys()): + might_removed = ms.extras(fname).get(b'merge-removal-candidate') + if might_removed == b'yes': + if fname in ctx: + files.mark_salvaged(fname) + return mn, files