comparison mercurial/streamclone.py @ 50513:43ed1f12b00a

stream-clone: yield cache entry in `_entries_walk` too The new function now cover the same ground as _v2_walk.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 21 May 2023 03:21:00 +0200
parents 06d580b8f432
children 0558866957fa
comparison
equal deleted inserted replaced
50512:06d580b8f432 50513:43ed1f12b00a
680 obsolescence=includeobsmarkers, 680 obsolescence=includeobsmarkers,
681 ) 681 )
682 for entry in entries: 682 for entry in entries:
683 yield (_srcstore, entry) 683 yield (_srcstore, entry)
684 684
685 for name in cacheutil.cachetocopy(repo):
686 if repo.cachevfs.exists(name):
687 # not really a StoreEntry, but close enough
688 entry = store.SimpleStoreEntry(
689 entry_path=name,
690 is_volatile=True,
691 )
692 yield (_srccache, entry)
693
685 694
686 def _v2_walk(repo, includes, excludes, includeobsmarkers): 695 def _v2_walk(repo, includes, excludes, includeobsmarkers):
687 """emit a seris of files information useful to clone a repo 696 """emit a seris of files information useful to clone a repo
688 697
689 return (entries, totalfilesize) 698 return (entries, totalfilesize)
709 ft = _fileappend 718 ft = _fileappend
710 if f.is_volatile: 719 if f.is_volatile:
711 ft = _filefull 720 ft = _filefull
712 files.append((vfs_key, f.unencoded_path, ft, file_size)) 721 files.append((vfs_key, f.unencoded_path, ft, file_size))
713 totalfilesize += file_size 722 totalfilesize += file_size
714 for name in cacheutil.cachetocopy(repo):
715 if repo.cachevfs.exists(name):
716 totalfilesize += repo.cachevfs.lstat(name).st_size
717 files.append((_srccache, name, _filefull, None))
718 return files, totalfilesize 723 return files, totalfilesize
719 724
720 725
721 def generatev2(repo, includes, excludes, includeobsmarkers): 726 def generatev2(repo, includes, excludes, includeobsmarkers):
722 """Emit content for version 2 of a streaming clone. 727 """Emit content for version 2 of a streaming clone.