diff mercurial/streamclone.py @ 52012:e308439339e2

stream: rename TempCopyManager to VolatileManager We are going to be more subtle in our management of volatile file, so use a more semantic name.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 14 Oct 2024 15:11:49 +0200
parents f4733654f144
children 0ad269e24075
line wrap: on
line diff
--- a/mercurial/streamclone.py	Mon Oct 14 12:12:34 2024 -0400
+++ b/mercurial/streamclone.py	Mon Oct 14 15:11:49 2024 +0200
@@ -566,7 +566,7 @@
     return (src, name, ftype, copy(vfsmap[src].join(name)))
 
 
-class TempCopyManager:
+class VolatileManager:
     """Manage temporary backup of volatile file during stream clone
 
     This should be used as a Python context, the copies will be discarded when
@@ -659,12 +659,12 @@
         _(b'bundle'), total=totalfilesize, unit=_(b'bytes')
     )
     progress.update(0)
-    with TempCopyManager() as copy, progress:
-        # create a copy of volatile files
+    with VolatileManager() as volatiles, progress:
+        # make sure we preserve volatile files
         for k, vfs, e in entries:
             for f in e.files():
                 if f.is_volatile:
-                    copy(vfs.join(f.unencoded_path))
+                    volatiles(vfs.join(f.unencoded_path))
         # the first yield release the lock on the repository
         yield file_count, totalfilesize
         totalbytecount = 0
@@ -673,7 +673,7 @@
             entry_streams = e.get_streams(
                 repo=repo,
                 vfs=vfs,
-                copies=copy,
+                volatiles=volatiles,
                 max_changeset=max_linkrev,
                 preserve_file_count=True,
             )
@@ -722,15 +722,15 @@
         unit=_(b'entry'),
     )
     progress.update(0)
-    with TempCopyManager() as copy, progress:
-        # create a copy of volatile files
+    with VolatileManager() as volatiles, progress:
+        # make sure we preserve volatile files
         for k, vfs, e in entries:
             if e.maybe_volatile:
                 for f in e.files():
                     if f.is_volatile:
                         # record the expected size under lock
                         f.file_size(vfs)
-                        copy(vfs.join(f.unencoded_path))
+                        volatiles(vfs.join(f.unencoded_path))
         # the first yield release the lock on the repository
         yield None
 
@@ -740,7 +740,7 @@
             entry_streams = e.get_streams(
                 repo=repo,
                 vfs=vfs,
-                copies=copy,
+                volatiles=volatiles,
                 max_changeset=max_linkrev,
             )
             yield util.uvarintencode(len(entry_streams))