mercurial/localrepo.py
changeset 50128 2f60cd6442fd
parent 50127 ec769cbc1fa2
child 50186 8bc14ac53a41
--- a/mercurial/localrepo.py	Wed Feb 22 01:04:55 2023 +0100
+++ b/mercurial/localrepo.py	Wed Feb 22 01:08:25 2023 +0100
@@ -1465,6 +1465,7 @@
         # - bookmark changes
         self.filteredrevcache = {}
 
+        self._dirstate = None
         # post-dirstate-status hooks
         self._postdsstatus = []
 
@@ -1752,9 +1753,11 @@
 
     @unfilteredpropertycache
     def dirstate(self):
-        # XXX This is known to be missing smarter caching. Check the next
-        # changesets
-        return self._makedirstate()
+        if self._dirstate is None:
+            self._dirstate = self._makedirstate()
+        else:
+            self._dirstate.refresh()
+        return self._dirstate
 
     def _makedirstate(self):
         """Extension point for wrapping the dirstate per-repo."""