changeset 46214:5dfa837d933e

engine: refactor how total dstsize is calculated Instead of increasing it with each revlog, we just get the sum of total destination changelog, manifest and filelogs sizes. Differential Revision: https://phab.mercurial-scm.org/D9665
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 30 Dec 2020 16:11:24 +0530
parents 30310886d423
children 82f3ee1a505f
files mercurial/upgrade_utils/engine.py
diffstat 1 files changed, 4 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/upgrade_utils/engine.py	Wed Dec 16 14:00:41 2020 +0530
+++ b/mercurial/upgrade_utils/engine.py	Wed Dec 30 16:11:24 2020 +0530
@@ -285,9 +285,7 @@
             oncopiedrevision,
         )
         info = newrl.storageinfo(storedsize=True)
-        datasize = info[b'storedsize'] or 0
-        dstsize += datasize
-        fdstsize += datasize
+        fdstsize += info[b'storedsize'] or 0
     ui.status(
         _(
             b'finished migrating %d filelog revisions across %d '
@@ -328,9 +326,7 @@
             oncopiedrevision,
         )
         info = newrl.storageinfo(storedsize=True)
-        datasize = info[b'storedsize'] or 0
-        dstsize += datasize
-        mdstsize += datasize
+        mdstsize += info[b'storedsize'] or 0
     ui.status(
         _(
             b'finished migrating %d manifest revisions across %d '
@@ -370,9 +366,7 @@
             oncopiedrevision,
         )
         info = newrl.storageinfo(storedsize=True)
-        datasize = info[b'storedsize'] or 0
-        dstsize += datasize
-        cdstsize += datasize
+        cdstsize += info[b'storedsize'] or 0
     progress.complete()
     ui.status(
         _(
@@ -382,6 +376,7 @@
         % (crevcount, util.bytecount(cdstsize - csrcsize))
     )
 
+    dstsize = fdstsize + mdstsize + cdstsize
     ui.status(
         _(
             b'finished migrating %d total revisions; total change in store '