[Updated] D11423: dirstate: same logic as what we did for `_drop`

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Mon Sep 20 14:06:55 UTC 2021


Closed by commit rHGffde999a3ea9: dirstate: same logic as what we did for `_drop` (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11423?vs=30261&id=30305

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11423/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D11423

AFFECTED FILES
  mercurial/dirstate.py
  mercurial/dirstatemap.py

CHANGE DETAILS

diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -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,
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -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"""



To: marmoute, #hg-reviewers, Alphare
Cc: Alphare, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210920/08b216a9/attachment-0002.html>


More information about the Mercurial-patches mailing list