mercurial/store.py
changeset 50632 786443bd3bc1
parent 50631 b59e0a4f692f
child 50638 8fc10bfd9887
--- a/mercurial/store.py	Sun May 28 03:46:48 2023 +0200
+++ b/mercurial/store.py	Mon May 29 04:24:29 2023 +0200
@@ -578,12 +578,12 @@
     is_volatile = attr.ib(default=False)
 
     def file_size(self, vfs):
-        if self._file_size is not None:
-            return self._file_size
-        try:
-            return vfs.stat(self.unencoded_path).st_size
-        except FileNotFoundError:
-            return 0
+        if self._file_size is None:
+            try:
+                self._file_size = vfs.stat(self.unencoded_path).st_size
+            except FileNotFoundError:
+                self._file_size = 0
+        return self._file_size
 
 
 def _gather_revlog(files_data):