dirstate: use `cachestat` object for dirstatemap identity
There is a class dedicated to this kind of cache check, let us use it.
We will generalize this code in the next changesets, but we do the "behavior
changing" pass on our own.
--- a/mercurial/dirstatemap.py Tue Feb 21 22:17:33 2023 +0100
+++ b/mercurial/dirstatemap.py Wed Feb 22 00:53:51 2023 +0100
@@ -263,9 +263,10 @@
def read(self):
# ignore HG_PENDING because identity is used only for writing
- self.identity = util.filestat.frompath(
- self._opener.join(self._filename)
- )
+ try:
+ self.identity = util.cachestat(self._opener.join(self._filename))
+ except FileNotFoundError:
+ self.identity = None
if self._use_dirstate_v2:
if not self.docket.uuid:
@@ -528,9 +529,12 @@
Fills the Dirstatemap when called.
"""
# ignore HG_PENDING because identity is used only for writing
- self.identity = util.filestat.frompath(
- self._opener.join(self._filename)
- )
+ try:
+ self.identity = util.cachestat(
+ self._opener.join(self._filename)
+ )
+ except FileNotFoundError:
+ self.identity = None
if self._use_dirstate_v2:
if self.docket.uuid: