diff mercurial/dirstatemap.py @ 48060:a660d8a53267

dirstate: use a new `drop_merge_data` in `setparent` What is happening in this `setparent` loop is that we remove all `merge` related information when the dirstate is moved out of a `merge` situation. So instead of shuffling state to get them where we want, we simply add a method on the DirstateItem to do drop the information we want dropped. Differential Revision: https://phab.mercurial-scm.org/D11506
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 22 Sep 2021 17:46:29 +0200
parents 5d68c4eedd66
children 060cd909439f
line wrap: on
line diff
--- a/mercurial/dirstatemap.py	Wed Sep 22 15:17:12 2021 +0200
+++ b/mercurial/dirstatemap.py	Wed Sep 22 17:46:29 2021 +0200
@@ -441,26 +441,11 @@
                     continue
 
                 # Discard "merged" markers when moving away from a merge state
-                if s.merged:
-                    source = self.copymap.get(f)
+                if s.merged or s.from_p2:
+                    source = self.copymap.pop(f, None)
                     if source:
                         copies[f] = source
-                    self.reset_state(
-                        f,
-                        wc_tracked=True,
-                        p1_tracked=True,
-                        possibly_dirty=True,
-                    )
-                # Also fix up otherparent markers
-                elif s.from_p2:
-                    source = self.copymap.get(f)
-                    if source:
-                        copies[f] = source
-                    self.reset_state(
-                        f,
-                        p1_tracked=False,
-                        wc_tracked=True,
-                    )
+                    s.drop_merge_data()
         return copies
 
     def read(self):