changeset 42712:896fb9deeaf8

upgrade: walk the source store file only once I don't expect this to have a significant performance impact, but it seems simpler and saner to do the operation only once and to keep the result around.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 27 Jul 2019 19:58:17 +0200
parents 716d575df275
children 095dcdd0d55c
files mercurial/upgrade.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/upgrade.py	Wed Jun 12 14:22:49 2019 +0100
+++ b/mercurial/upgrade.py	Sat Jul 27 19:58:17 2019 +0200
@@ -554,9 +554,11 @@
     crawsize = 0
     cdstsize = 0
 
+    alldatafiles = list(srcrepo.store.walk())
+
     # Perform a pass to collect metadata. This validates we can open all
     # source files and allows a unified progress bar to be displayed.
-    for unencoded, encoded, size in srcrepo.store.walk():
+    for unencoded, encoded, size in alldatafiles:
         if unencoded.endswith('.d'):
             continue
 
@@ -607,7 +609,7 @@
     # Do the actual copying.
     # FUTURE this operation can be farmed off to worker processes.
     seen = set()
-    for unencoded, encoded, size in srcrepo.store.walk():
+    for unencoded, encoded, size in alldatafiles:
         if unencoded.endswith('.d'):
             continue