comparison mercurial/copies.py @ 47469:5fa083a5ff04

copies: Keep changelog sidedata file open during copy tracing Instead of having a callback that opens and closes that file many times, a add and use a context manager method on the `revlog` class that keeps files open for its duration. Differential Revision: https://phab.mercurial-scm.org/D10888
author Simon Sapin <simon.sapin@octobus.net>
date Thu, 17 Jun 2021 19:48:25 +0200
parents d55b71393907
children d86875b75838
comparison
equal deleted inserted replaced
47468:75d4e60c7c81 47469:5fa083a5ff04
316 continue 316 continue
317 children_count[r] = 0 317 children_count[r] = 0
318 if p in children_count: 318 if p in children_count:
319 children_count[p] += 1 319 children_count[p] += 1
320 revinfo = _revinfo_getter(repo, match) 320 revinfo = _revinfo_getter(repo, match)
321 return _combine_changeset_copies( 321 with repo.changelog.reading():
322 revs, 322 return _combine_changeset_copies(
323 children_count, 323 revs,
324 b.rev(), 324 children_count,
325 revinfo, 325 b.rev(),
326 match, 326 revinfo,
327 isancestor, 327 match,
328 multi_thread, 328 isancestor,
329 ) 329 multi_thread,
330 )
330 else: 331 else:
331 # When not using side-data, we will process the edges "from" the parent. 332 # When not using side-data, we will process the edges "from" the parent.
332 # so we need a full mapping of the parent -> children relation. 333 # so we need a full mapping of the parent -> children relation.
333 children = dict((r, []) for r in roots) 334 children = dict((r, []) for r in roots)
334 for r in revs: 335 for r in revs: