diff mercurial/mergestate.py @ 45530:6877b0ee5f9d

mergestate: introduce a new ACTION_KEEP_NEW `ACTION_KEEP` is overloaded and it's hard to figure out how we end up with this KEEP, what was the state of things. In a previous patch, we introduced `ACTION_KEEP_ABSENT` which represents files which are kept absent in the working directory. There is another special case where we keep the file when it's not present on both ancestor and remote side. We introduce a dedicated action for that. The goal is to use these information to make bid merge smarter. Differential Revision: https://phab.mercurial-scm.org/D9002
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 09 Sep 2020 16:49:19 +0530
parents 32ce4cbaec4b
children 590a840fa367
line wrap: on
line diff
--- a/mercurial/mergestate.py	Mon Sep 21 10:23:25 2020 -0400
+++ b/mercurial/mergestate.py	Wed Sep 09 16:49:19 2020 +0530
@@ -117,6 +117,9 @@
 # keep it absent (absent means file not present, it can be a result
 # of file deletion, rename etc.)
 ACTION_KEEP_ABSENT = b'ka'
+# the file is absent on the ancestor and remote side of the merge
+# hence this file is new and we should keep it
+ACTION_KEEP_NEW = b'kn'
 ACTION_EXEC = b'e'
 ACTION_CREATED_MERGE = b'cm'
 
@@ -767,6 +770,10 @@
     for f, args, msg in actions.get(ACTION_KEEP_ABSENT, []):
         pass
 
+    # keep new
+    for f, args, msg in actions.get(ACTION_KEEP_NEW, []):
+        pass
+
     # get
     for f, args, msg in actions.get(ACTION_GET, []):
         if branchmerge: