memctx: always use cache for filectxfn
authorSean Farley <sean@farley.io>
Sat, 10 Jun 2017 16:00:18 -0700
changeset 32781 448fc659a430
parent 32780 5e76a07e9f42
child 32782 9a4adc76c88a
memctx: always use cache for filectxfn I don't see a downside to doing this unless I'm missing something. Thanks to foozy for correcting my previous bad logic.
mercurial/context.py
--- a/mercurial/context.py	Sat Jun 10 00:06:57 2017 -0400
+++ b/mercurial/context.py	Sat Jun 10 16:00:18 2017 -0700
@@ -2106,13 +2106,13 @@
         self.substate = {}
 
         if isinstance(filectxfn, patch.filestore):
-            self._filectxfn = memfilefrompatch(filectxfn)
+            filectxfn = memfilefrompatch(filectxfn)
         elif not callable(filectxfn):
             # if store is not callable, wrap it in a function
-            self._filectxfn = memfilefromctx(filectxfn)
-        else:
-            # memoizing increases performance for e.g. vcs convert scenarios.
-            self._filectxfn = makecachingfilectxfn(filectxfn)
+            filectxfn = memfilefromctx(filectxfn)
+
+        # memoizing increases performance for e.g. vcs convert scenarios.
+        self._filectxfn = makecachingfilectxfn(filectxfn)
 
         if editor:
             self._text = editor(self._repo, self, [])