Mercurial > hg-stable
changeset 45662:64a4b85c4a00
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
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 14 Sep 2020 23:47:42 +0200 |
parents | ebc14a2ad23d |
children | cf474af69766 |
files | mercurial/commit.py |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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