Mercurial > hg
diff mercurial/dirstatemap.py @ 47974:4e6f27230aee
dirstate: introduce a `set_clean` method on dirstate's map and items
This method is the "reverse" of "set possibly dirty", and can be used to more
accurately other call that the dirstate was making. It is currently heavily
influenced by its origin.
Differential Revision: https://phab.mercurial-scm.org/D11421
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 02 Sep 2021 03:59:35 +0200 |
parents | 5a6c1ef4bcac |
children | ffde999a3ea9 |
line wrap: on
line diff
--- a/mercurial/dirstatemap.py Thu Sep 02 04:03:20 2021 +0200 +++ b/mercurial/dirstatemap.py Thu Sep 02 03:59:35 2021 +0200 @@ -162,6 +162,15 @@ """record that the current state of the file on disk is unknown""" self[filename].set_possibly_dirty() + 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) + self.nonnormalset.discard(filename) + def addfile( self, f, @@ -924,6 +933,15 @@ entry.set_possibly_dirty() self._rustmap.set_v1(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._rustmap.set_v1(filename, entry) + self._rustmap.copymap().pop(filename, None) + def __setitem__(self, key, value): assert isinstance(value, DirstateItem) self._rustmap.set_v1(key, value)