diff mercurial/context.py @ 52735:f071b18e1382

overlayctx: build a memctx that can access non touched files So far, the memctx was very optimized for being committed: so it did not need to access any untouched files. However the way we uses it in evolve to diff against more arbitrary changes requires to be able to access to any file content as any other ctx. This is now the case.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 01 Feb 2025 13:04:32 +0100
parents e627cc25b6f3
children a502f3f389b5
line wrap: on
line diff
--- a/mercurial/context.py	Sat Jan 25 23:49:24 2025 +0100
+++ b/mercurial/context.py	Sat Feb 01 13:04:32 2025 +0100
@@ -2542,7 +2542,9 @@
         files = self.files()
 
         def getfile(repo, memctx, path):
-            if self._cache[path][b'exists']:
+            if path not in self._cache:
+                return self.filectx(path)
+            elif self._cache[path][b'exists']:
                 return memfilectx(
                     repo,
                     memctx,