##// END OF EJS Templates
context: don't use util.cachefunc due to cycle creation (issue5043)...
Gregory Szorc -
r27906:c183f7b7 default
parent child Browse files
Show More
@@ -1779,6 +1779,22 b' class workingcommitctx(workingctx):'
1779 1779 changed.update(self._status.removed)
1780 1780 return changed
1781 1781
1782 def makecachingfilectxfn(func):
1783 """Create a filectxfn that caches based on the path.
1784
1785 We can't use util.cachefunc because it uses all arguments as the cache
1786 key and this creates a cycle since the arguments include the repo and
1787 memctx.
1788 """
1789 cache = {}
1790
1791 def getfilectx(repo, memctx, path):
1792 if path not in cache:
1793 cache[path] = func(repo, memctx, path)
1794 return cache[path]
1795
1796 return getfilectx
1797
1782 1798 class memctx(committablectx):
1783 1799 """Use memctx to perform in-memory commits via localrepo.commitctx().
1784 1800
@@ -1838,9 +1854,8 b' class memctx(committablectx):'
1838 1854 copied=copied, memctx=memctx)
1839 1855 self._filectxfn = getfilectx
1840 1856 else:
1841 # "util.cachefunc" reduces invocation of possibly expensive
1842 # "filectxfn" for performance (e.g. converting from another VCS)
1843 self._filectxfn = util.cachefunc(filectxfn)
1857 # memoizing increases performance for e.g. vcs convert scenarios.
1858 self._filectxfn = makecachingfilectxfn(filectxfn)
1844 1859
1845 1860 if extra:
1846 1861 self._extra = extra.copy()
General Comments 0
You need to be logged in to leave comments. Login now