# HG changeset patch # User Pierre-Yves David # Date 1677023631 -3600 # Node ID eedbf82562631607589bd5e8542e463d2f4da9b0 # Parent 18149ecb51220ad9e93d943466936ef3f3f8495a 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. diff -r 18149ecb5122 -r eedbf8256263 mercurial/dirstatemap.py --- 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: