# HG changeset patch # User Pierre-Yves David # Date 1631693125 -7200 # Node ID ffde999a3ea9e15613e5e9fa3a8f2ecd167858bb # Parent 36c0d738c3302c7a282a016681b5b2bbc9caf371 dirstate: same logic as what we did for `_drop` This is part of the dirstatemap so let the dirstatemap deal with it. Differential Revision: https://phab.mercurial-scm.org/D11423 diff -r 36c0d738c330 -r ffde999a3ea9 mercurial/dirstate.py --- a/mercurial/dirstate.py Wed Sep 15 09:28:17 2021 +0200 +++ b/mercurial/dirstate.py Wed Sep 15 10:05:25 2021 +0200 @@ -738,7 +738,6 @@ def _add(self, filename): """internal function to mark a file as added""" self._addpath(filename, added=True) - self._map.copymap.pop(filename, None) def _drop(self, filename): """internal function to drop a file from the dirstate""" diff -r 36c0d738c330 -r ffde999a3ea9 mercurial/dirstatemap.py --- a/mercurial/dirstatemap.py Wed Sep 15 09:28:17 2021 +0200 +++ b/mercurial/dirstatemap.py Wed Sep 15 10:05:25 2021 +0200 @@ -188,6 +188,7 @@ assert not possibly_dirty assert not from_p2 new_entry = DirstateItem.new_added() + self.copymap.pop(f, None) elif merged: assert not possibly_dirty assert not from_p2 @@ -567,7 +568,7 @@ from_p2=False, possibly_dirty=False, ): - return self._rustmap.addfile( + ret = self._rustmap.addfile( f, mode, size, @@ -577,6 +578,9 @@ from_p2, possibly_dirty, ) + if added: + self.copymap.pop(f, None) + return ret def reset_state( self,