Mercurial > public > mercurial-scm > hg
comparison mercurial/upgrade.py @ 39870:b399ff55ee6d
upgrade: use storageinfo() for obtaining storage metadata
Let's switch to our new API for obtaining information about storage.
This eliminates the last consumer of rawsize() and the opener proxy
from the file storage interface!
Differential Revision: https://phab.mercurial-scm.org/D4748
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 24 Sep 2018 12:39:34 -0700 |
parents | 32d3ed3023bb |
children | dbcb466d0065 |
comparison
equal
deleted
inserted
replaced
39869:14e500b58263 | 39870:b399ff55ee6d |
---|---|
481 for unencoded, encoded, size in srcrepo.store.walk(): | 481 for unencoded, encoded, size in srcrepo.store.walk(): |
482 if unencoded.endswith('.d'): | 482 if unencoded.endswith('.d'): |
483 continue | 483 continue |
484 | 484 |
485 rl = _revlogfrompath(srcrepo, unencoded) | 485 rl = _revlogfrompath(srcrepo, unencoded) |
486 revcount += len(rl) | 486 |
487 | 487 info = rl.storageinfo(exclusivefiles=True, revisionscount=True, |
488 datasize = 0 | 488 trackedsize=True, storedsize=True) |
489 rawsize = 0 | 489 |
490 | 490 revcount += info['revisionscount'] or 0 |
491 for path in rl.files(): | 491 datasize = info['storedsize'] or 0 |
492 datasize += rl.opener.stat(path).st_size | 492 rawsize = info['trackedsize'] or 0 |
493 | |
494 rawsize += sum(map(rl.rawsize, iter(rl))) | |
495 | 493 |
496 srcsize += datasize | 494 srcsize += datasize |
497 srcrawsize += rawsize | 495 srcrawsize += rawsize |
498 | 496 |
499 # This is for the separate progress bars. | 497 # This is for the separate progress bars. |
579 ui.note(_('cloning %d revisions from %s\n') % (len(oldrl), unencoded)) | 577 ui.note(_('cloning %d revisions from %s\n') % (len(oldrl), unencoded)) |
580 oldrl.clone(tr, newrl, addrevisioncb=oncopiedrevision, | 578 oldrl.clone(tr, newrl, addrevisioncb=oncopiedrevision, |
581 deltareuse=deltareuse, | 579 deltareuse=deltareuse, |
582 deltabothparents=deltabothparents) | 580 deltabothparents=deltabothparents) |
583 | 581 |
584 datasize = 0 | 582 info = newrl.storageinfo(storedsize=True) |
585 for path in newrl.files(): | 583 datasize = info['storedsize'] or 0 |
586 datasize += newrl.opener.stat(path).st_size | |
587 | 584 |
588 dstsize += datasize | 585 dstsize += datasize |
589 | 586 |
590 if isinstance(newrl, changelog.changelog): | 587 if isinstance(newrl, changelog.changelog): |
591 cdstsize += datasize | 588 cdstsize += datasize |