changeset 48131:f903a357ba72

dirstatemap: use common code for set_clean Same logic before this make sure both implementation use the same logic for this. Differential Revision: https://phab.mercurial-scm.org/D11576
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 01 Oct 2021 23:49:40 +0200
parents 743808de0c03
children c057d7c97b72
files mercurial/dirstatemap.py
diffstat 1 files changed, 9 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstatemap.py	Fri Oct 01 23:42:24 2021 +0200
+++ b/mercurial/dirstatemap.py	Fri Oct 01 23:49:40 2021 +0200
@@ -115,6 +115,15 @@
         entry.set_possibly_dirty()
         self._refresh_entry(filename, entry)
 
+    def set_clean(self, filename, mode, size, mtime):
+        """mark a file as back to a clean state"""
+        entry = self[filename]
+        mtime = mtime & rangemask
+        size = size & rangemask
+        entry.set_clean(mode, size, mtime)
+        self._refresh_entry(filename, entry)
+        self.copymap.pop(filename, None)
+
     def set_tracked(self, filename):
         new = False
         entry = self.get(filename)
@@ -449,14 +458,6 @@
     def _insert_entry(self, f, entry):
         self._map[f] = entry
 
-    def set_clean(self, filename, mode, size, mtime):
-        """mark a file as back to a clean state"""
-        entry = self[filename]
-        mtime = mtime & rangemask
-        size = size & rangemask
-        entry.set_clean(mode, size, mtime)
-        self.copymap.pop(filename, None)
-
     def reset_state(
         self,
         filename,
@@ -801,15 +802,6 @@
         def _insert_entry(self, f, entry):
             self._map.addfile(f, entry)
 
-        def set_clean(self, filename, mode, size, mtime):
-            """mark a file as back to a clean state"""
-            entry = self[filename]
-            mtime = mtime & rangemask
-            size = size & rangemask
-            entry.set_clean(mode, size, mtime)
-            self._map.set_dirstate_item(filename, entry)
-            self._map.copymap().pop(filename, None)
-
         def __setitem__(self, key, value):
             assert isinstance(value, DirstateItem)
             self._map.set_dirstate_item(key, value)