diff mercurial/upgrade.py @ 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 32d3ed3023bb
children dbcb466d0065
line wrap: on
line diff
--- 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