Mercurial > hg
changeset 50125:eedbf8256263
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.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 22 Feb 2023 00:53:51 +0100 |
parents | 18149ecb5122 |
children | 85746485a4dd |
files | mercurial/dirstatemap.py |
diffstat | 1 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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: