Show More
@@ -1779,6 +1779,22 b' class workingcommitctx(workingctx):' | |||||
1779 | changed.update(self._status.removed) |
|
1779 | changed.update(self._status.removed) | |
1780 | return changed |
|
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 | class memctx(committablectx): |
|
1798 | class memctx(committablectx): | |
1783 | """Use memctx to perform in-memory commits via localrepo.commitctx(). |
|
1799 | """Use memctx to perform in-memory commits via localrepo.commitctx(). | |
1784 |
|
1800 | |||
@@ -1838,9 +1854,8 b' class memctx(committablectx):' | |||||
1838 | copied=copied, memctx=memctx) |
|
1854 | copied=copied, memctx=memctx) | |
1839 | self._filectxfn = getfilectx |
|
1855 | self._filectxfn = getfilectx | |
1840 | else: |
|
1856 | else: | |
1841 | # "util.cachefunc" reduces invocation of possibly expensive |
|
1857 | # memoizing increases performance for e.g. vcs convert scenarios. | |
1842 | # "filectxfn" for performance (e.g. converting from another VCS) |
|
1858 | self._filectxfn = makecachingfilectxfn(filectxfn) | |
1843 | self._filectxfn = util.cachefunc(filectxfn) |
|
|||
1844 |
|
1859 | |||
1845 | if extra: |
|
1860 | if extra: | |
1846 | self._extra = extra.copy() |
|
1861 | self._extra = extra.copy() |
General Comments 0
You need to be logged in to leave comments.
Login now