engine: refactor how total dstsize is calculated
authorPulkit Goyal <7895pulkit@gmail.com>
Wed, 30 Dec 2020 16:11:24 +0530
changeset 46214 5dfa837d933e
parent 46213 30310886d423
child 46215 82f3ee1a505f
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
mercurial/upgrade_utils/engine.py
--- 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 '