Mercurial > hg-stable
changeset 39875: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 | 14e500b58263 |
children | 01c0f01b562b |
files | mercurial/filelog.py mercurial/upgrade.py |
diffstat | 2 files changed, 9 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/filelog.py Mon Sep 24 11:56:48 2018 -0700 +++ b/mercurial/filelog.py Mon Sep 24 12:39:34 2018 -0700 @@ -77,7 +77,7 @@ def iscensored(self, rev): return self._revlog.iscensored(rev) - # Used by repo upgrade, verify. + # Used by repo verify. def rawsize(self, rev): return self._revlog.rawsize(rev) @@ -207,7 +207,7 @@ def indexfile(self, value): self._revlog.indexfile = value - # Used by repo upgrade. + # Unused. @property def opener(self): return self._revlog.opener
--- a/mercurial/upgrade.py Mon Sep 24 11:56:48 2018 -0700 +++ b/mercurial/upgrade.py Mon Sep 24 12:39:34 2018 -0700 @@ -483,15 +483,13 @@ continue rl = _revlogfrompath(srcrepo, unencoded) - revcount += len(rl) - datasize = 0 - rawsize = 0 + info = rl.storageinfo(exclusivefiles=True, revisionscount=True, + trackedsize=True, storedsize=True) - for path in rl.files(): - datasize += rl.opener.stat(path).st_size - - rawsize += sum(map(rl.rawsize, iter(rl))) + revcount += info['revisionscount'] or 0 + datasize = info['storedsize'] or 0 + rawsize = info['trackedsize'] or 0 srcsize += datasize srcrawsize += rawsize @@ -581,9 +579,8 @@ deltareuse=deltareuse, deltabothparents=deltabothparents) - datasize = 0 - for path in newrl.files(): - datasize += newrl.opener.stat(path).st_size + info = newrl.storageinfo(storedsize=True) + datasize = info['storedsize'] or 0 dstsize += datasize