Patchwork D11576: dirstatemap: use common code for set_clean

login
register
mail settings
Submitter phabricator
Date Oct. 2, 2021, 3:05 p.m.
Message ID <differential-rev-PHID-DREV-sjdwj2n6args2gfhhmzh-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49900/
State Superseded
Headers show

Comments

phabricator - Oct. 2, 2021, 3:05 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Same logic before this make sure both implementation use the same logic for this.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dirstatemap.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

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