comparison mercurial/context.py @ 41154:f18f665b1424

context: schedule file prefetch before comparing for cleanliness When using a system like remotefilelog, we can occasionally run into scenarios where the local content cache does not have the data we need to perform these comparisons. These will be fetched on-demand, but individually; if the remotefilelog server isn't extremely low latency, the runtime of the command becomes dominated by the multiple getfile requests for individual files. By performing the prefetch, we can download these files in bulk, and save server resources and many network roundtrips. Differential Revision: https://phab.mercurial-scm.org/D5532
author Kyle Lippincott <spectral@google.com>
date Tue, 08 Jan 2019 14:31:22 -0800
parents 21ffe6b97a25
children b129837190f7
comparison
equal deleted inserted replaced
41153:2c3f69855ce8 41154:f18f665b1424
2016 2016
2017 This can occur during the merge process, e.g. by passing --tool :local 2017 This can occur during the merge process, e.g. by passing --tool :local
2018 to resolve a conflict. 2018 to resolve a conflict.
2019 """ 2019 """
2020 keys = [] 2020 keys = []
2021 # This won't be perfect, but can help performance significantly when
2022 # using things like remotefilelog.
2023 scmutil.prefetchfiles(
2024 self.repo(), [self.p1().rev()],
2025 matchmod.match('', '', patterns=self._cache.keys(), exact=True))
2026
2021 for path in self._cache.keys(): 2027 for path in self._cache.keys():
2022 cache = self._cache[path] 2028 cache = self._cache[path]
2023 try: 2029 try:
2024 underlying = self._wrappedctx[path] 2030 underlying = self._wrappedctx[path]
2025 if (underlying.data() == cache['data'] and 2031 if (underlying.data() == cache['data'] and