Patchwork D11146: dirstate: introduce a `set_clean` method

login
register
mail settings
Submitter phabricator
Date July 19, 2021, 10:43 a.m.
Message ID <differential-rev-PHID-DREV-5riy4y2ewmhwbw7pqgjt-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49460/
State Superseded
Headers show

Comments

phabricator - July 19, 2021, 10:43 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This will provide a good alternative to `normal` call with a narrower semantic.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -499,6 +499,13 @@ 
             self._remove(filename)
             return True
 
+    @requires_no_parents_change
+    def set_clean(self, filename, parentfiledata=None):
+        """record that the current state of the file on disk is known to be clean"""
+        self._dirty = True
+        self._updatedfiles.add(filename)
+        self.normal(filename, parentfiledata=parentfiledata)
+
     @requires_parents_change
     def update_file_p1(
         self,