comparison mercurial/exchangev2.py @ 40035:7a347d362a45

exchangev2: add progress bar around manifest scanning This can take a long time on large repositories. Let's add a progress bar so we don't have long periods where it isn't obvious what is going on. Differential Revision: https://phab.mercurial-scm.org/D4859
author Gregory Szorc <gregory.szorc@gmail.com>
date Wed, 03 Oct 2018 13:54:31 -0700
parents d059cb669632
children b797150a1ab9
comparison
equal deleted inserted replaced
40034:393e44324037 40035:7a347d362a45
318 node. 318 node.
319 """ 319 """
320 ml = repo.manifestlog 320 ml = repo.manifestlog
321 fnodes = collections.defaultdict(dict) 321 fnodes = collections.defaultdict(dict)
322 322
323 for manifestnode in manifestnodes: 323 progress = repo.ui.makeprogress(
324 m = ml.get(b'', manifestnode) 324 _('scanning manifests'), total=len(manifestnodes))
325 325
326 # TODO this will pull in unwanted nodes because it takes the storage 326 with progress:
327 # delta into consideration. What we really want is something that takes 327 for manifestnode in manifestnodes:
328 # the delta between the manifest's parents. And ideally we would 328 m = ml.get(b'', manifestnode)
329 # ignore file nodes that are known locally. For now, ignore both 329
330 # these limitations. This will result in incremental fetches requesting 330 # TODO this will pull in unwanted nodes because it takes the storage
331 # data we already have. So this is far from ideal. 331 # delta into consideration. What we really want is something that
332 md = m.readfast() 332 # takes the delta between the manifest's parents. And ideally we
333 333 # would ignore file nodes that are known locally. For now, ignore
334 for path, fnode in md.items(): 334 # both these limitations. This will result in incremental fetches
335 fnodes[path].setdefault(fnode, manifestnode) 335 # requesting data we already have. So this is far from ideal.
336 md = m.readfast()
337
338 for path, fnode in md.items():
339 fnodes[path].setdefault(fnode, manifestnode)
340
341 progress.increment()
336 342
337 return fnodes 343 return fnodes
338 344
339 def _fetchfiles(repo, tr, remote, fnodes, linkrevs): 345 def _fetchfiles(repo, tr, remote, fnodes, linkrevs):
340 def iterrevisions(objs, progress): 346 def iterrevisions(objs, progress):