diff mercurial/merge.py @ 45587:768412472663

merge: store cases when a file is absent post merge in commitinfo Some merges can result in file being absent form working directory. This can be one of file was kept deleted or file was removed by merge code. User might revert the file back before committing. In such cases we will like to have better handling and create new filenodes. We store this info in mergestate as commitinfo so that we can use it while committing to create new filenode if required. Differential Revision: https://phab.mercurial-scm.org/D9003
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 24 Aug 2020 15:35:34 +0530
parents 4c8a93ec6908
children ad984583969a
line wrap: on
line diff
--- a/mercurial/merge.py	Mon Sep 14 15:08:15 2020 +0530
+++ b/mercurial/merge.py	Mon Aug 24 15:35:34 2020 +0530
@@ -923,6 +923,15 @@
                     mresult.addfile(
                         f, mergestatemod.ACTION_REMOVE, None, b'other deleted',
                     )
+                    if branchmerge:
+                        # the file must be absent after merging,
+                        # howeber the user might make
+                        # the file reappear using revert and if they does,
+                        # we force create a new node
+                        mresult.addcommitinfo(
+                            f, b'merge-removal-candidate', b'yes'
+                        )
+
             else:  # file not in ancestor, not in remote
                 mresult.addfile(
                     f,
@@ -1033,6 +1042,12 @@
                     None,
                     b'local not present, remote unchanged',
                 )
+                if branchmerge:
+                    # the file must be absent after merging
+                    # however the user might make
+                    # the file reappear using revert and if they does,
+                    # we force create a new node
+                    mresult.addcommitinfo(f, b'merge-removal-candidate', b'yes')
 
     if repo.ui.configbool(b'experimental', b'merge.checkpathconflicts'):
         # If we are merging, look for path conflicts.