[Request] [+ ] D9120: salvaged: record salvaged in ChangingFiles at commit time

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Tue Sep 29 10:37:14 UTC 2020


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

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
 
 



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20200929/1d0a44d2/attachment-0001.html>


More information about the Mercurial-patches mailing list