comparison mercurial/streamclone.py @ 50472:9fdc28e21b68

store: introduce a EntryFile object to actually access file info For now a StoreEntry match a single file, but the goal is to eventually combine multiple file in a higher level Entry, so we need to introduce this distinction and use it first.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 15 May 2023 08:56:40 +0200
parents 521fec115dad
children 4cbdfab6f812
comparison
equal deleted inserted replaced
50471:521fec115dad 50472:9fdc28e21b68
268 total_bytes = 0 268 total_bytes = 0
269 # Get consistent snapshot of repo, lock during scan. 269 # Get consistent snapshot of repo, lock during scan.
270 with repo.lock(): 270 with repo.lock():
271 repo.ui.debug(b'scanning\n') 271 repo.ui.debug(b'scanning\n')
272 for entry in _walkstreamfiles(repo): 272 for entry in _walkstreamfiles(repo):
273 if entry.file_size: 273 for f in entry.files():
274 entries.append((entry.unencoded_path, entry.file_size)) 274 if f.file_size:
275 total_bytes += entry.file_size 275 entries.append((f.unencoded_path, f.file_size))
276 total_bytes += f.file_size
276 _test_sync_point_walk_1(repo) 277 _test_sync_point_walk_1(repo)
277 _test_sync_point_walk_2(repo) 278 _test_sync_point_walk_2(repo)
278 279
279 repo.ui.debug( 280 repo.ui.debug(
280 b'%d files, %d bytes to transfer\n' % (len(entries), total_bytes) 281 b'%d files, %d bytes to transfer\n' % (len(entries), total_bytes)
676 matcher = None 677 matcher = None
677 if includes or excludes: 678 if includes or excludes:
678 matcher = narrowspec.match(repo.root, includes, excludes) 679 matcher = narrowspec.match(repo.root, includes, excludes)
679 680
680 for entry in _walkstreamfiles(repo, matcher): 681 for entry in _walkstreamfiles(repo, matcher):
681 if entry.file_size: 682 for f in entry.files():
682 ft = _fileappend 683 if f.file_size:
683 if entry.is_volatile: 684 ft = _fileappend
684 ft = _filefull 685 if f.is_volatile:
685 entries.append( 686 ft = _filefull
686 (_srcstore, entry.unencoded_path, ft, entry.file_size) 687 entries.append((_srcstore, f.unencoded_path, ft, f.file_size))
687 ) 688 totalfilesize += f.file_size
688 totalfilesize += entry.file_size
689 for name in _walkstreamfullstorefiles(repo): 689 for name in _walkstreamfullstorefiles(repo):
690 if repo.svfs.exists(name): 690 if repo.svfs.exists(name):
691 totalfilesize += repo.svfs.lstat(name).st_size 691 totalfilesize += repo.svfs.lstat(name).st_size
692 entries.append((_srcstore, name, _filefull, None)) 692 entries.append((_srcstore, name, _filefull, None))
693 if includeobsmarkers and repo.svfs.exists(b'obsstore'): 693 if includeobsmarkers and repo.svfs.exists(b'obsstore'):