[PATCH] dirstate: remove file from copymap on drop

Mateusz Kwapich mitrandir at fb.com
Wed May 25 23:09:51 UTC 2016


# HG changeset patch
# User Mateusz Kwapich <mitrandir at fb.com>
# Date 1464217747 25200
#      Wed May 25 16:09:07 2016 -0700
# Node ID a3862f2ec80d970d90afa326462bbfbf95c444bf
# Parent  5f509e6681089b79eccf7890a4632ef45006eb6d
dirstate: remove file from copymap on drop

As the copymap is short-lived object regenerated from dirstate on each
read this didn't affect us in any serious way. But since I've started working
on permanent storage of copymap in my experiments with sqldirstate[1] I've seen
this bug leaving the copy information in copymap after reverting the file
moves and copies.

[1] https://www.mercurial-scm.org/wiki/SQLDirstatePlan

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -582,6 +582,8 @@ class dirstate(object):
             del self._map[f]
             if f in self._nonnormalset:
                 self._nonnormalset.remove(f)
+            if f in self._copymap:
+                del self._copymap[f]
 
     def _discoverpath(self, path, normed, ignoremissing, exists, storemap):
         if exists is None:


More information about the Mercurial-devel mailing list