mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
remotefilelog: add seen set to annotate algorithm
The remotefilelog annotate logic was not keeping track of which commits it had seen when doing the bfs ancestor walk. For very mergy histories this resulted in a ton of duplicate work. Differential Revision: https://phab.mercurial-scm.org/D771
This commit is contained in:
parent
0e25d26f20
commit
999e3b7af5
@ -377,7 +377,9 @@ class remotefilectx(context.filectx):
|
||||
# like self.ancestors, but append to "fetch" and skip visiting parents
|
||||
# of nodes in "prefetchskip".
|
||||
fetch = []
|
||||
seen = set()
|
||||
queue = collections.deque((introctx,))
|
||||
seen.add(introctx.node())
|
||||
while queue:
|
||||
current = queue.pop()
|
||||
if current.filenode() != self.filenode():
|
||||
@ -386,7 +388,10 @@ class remotefilectx(context.filectx):
|
||||
fetch.append((current.path(), hex(current.filenode())))
|
||||
if prefetchskip and current in prefetchskip:
|
||||
continue
|
||||
map(queue.append, current.parents())
|
||||
for parent in current.parents():
|
||||
if parent.node() not in seen:
|
||||
seen.add(parent.node())
|
||||
queue.append(parent)
|
||||
|
||||
self._repo.ui.debug('remotefilelog: prefetching %d files '
|
||||
'for annotate\n' % len(fetch))
|
||||
|
Loading…
Reference in New Issue
Block a user