Patchwork D9120: salvaged: record salvaged in ChangingFiles at commit time

login
register
mail settings
Submitter phabricator
Date Sept. 29, 2020, 10:37 a.m.
Message ID <differential-rev-PHID-DREV-x3wsftdhvji5trlclo7t-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47334/
State Superseded
Headers show

Comments

phabricator - Sept. 29, 2020, 10:37 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9120

AFFECTED FILES
  mercurial/commit.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/commit.py b/mercurial/commit.py
--- a/mercurial/commit.py
+++ b/mercurial/commit.py
@@ -140,6 +140,21 @@ 
         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()):
+                if (
+                    ms.extras(fname).get(b'FILE_MIGHT_DELETE_BY_MERGE')
+                    == b'yes'
+                ):
+                    if fname in ctx:
+                        files.mark_undeleted(fname)
+
     return mn, files