##// END OF EJS Templates
streamingclone: extract the scanning part from the generation part...
marmoute -
r48237:2f4ca480 default
parent child Browse files
Show More
@@ -603,6 +603,47 b' def _test_sync_point_walk_2(repo):'
603 """a function for synchronisation during tests"""
603 """a function for synchronisation during tests"""
604
604
605
605
606 def _v2_walk(repo, includes, excludes, includeobsmarkers):
607 """emit a seris of files information useful to clone a repo
608
609 return (entries, totalfilesize)
610
611 entries is a list of tuple (vfs-key, file-path, file-type, size)
612
613 - `vfs-key`: is a key to the right vfs to write the file (see _makemap)
614 - `name`: file path of the file to copy (to be feed to the vfss)
615 - `file-type`: do this file need to be copied with the source lock ?
616 - `size`: the size of the file (or None)
617 """
618 assert repo._currentlock(repo._lockref) is not None
619 entries = []
620 totalfilesize = 0
621
622 matcher = None
623 if includes or excludes:
624 matcher = narrowspec.match(repo.root, includes, excludes)
625
626 for rl_type, name, ename, size in _walkstreamfiles(repo, matcher):
627 if size:
628 ft = _fileappend
629 if rl_type & store.FILEFLAGS_VOLATILE:
630 ft = _filefull
631 entries.append((_srcstore, name, ft, size))
632 totalfilesize += size
633 for name in _walkstreamfullstorefiles(repo):
634 if repo.svfs.exists(name):
635 totalfilesize += repo.svfs.lstat(name).st_size
636 entries.append((_srcstore, name, _filefull, None))
637 if includeobsmarkers and repo.svfs.exists(b'obsstore'):
638 totalfilesize += repo.svfs.lstat(b'obsstore').st_size
639 entries.append((_srcstore, b'obsstore', _filefull, None))
640 for name in cacheutil.cachetocopy(repo):
641 if repo.cachevfs.exists(name):
642 totalfilesize += repo.cachevfs.lstat(name).st_size
643 entries.append((_srccache, name, _filefull, None))
644 return entries, totalfilesize
645
646
606 def generatev2(repo, includes, excludes, includeobsmarkers):
647 def generatev2(repo, includes, excludes, includeobsmarkers):
607 """Emit content for version 2 of a streaming clone.
648 """Emit content for version 2 of a streaming clone.
608
649
@@ -618,32 +659,14 b' def generatev2(repo, includes, excludes,'
618
659
619 with repo.lock():
660 with repo.lock():
620
661
621 entries = []
662 repo.ui.debug(b'scanning\n')
622 totalfilesize = 0
623
624 matcher = None
625 if includes or excludes:
626 matcher = narrowspec.match(repo.root, includes, excludes)
627
663
628 repo.ui.debug(b'scanning\n')
664 entries, totalfilesize = _v2_walk(
629 for rl_type, name, ename, size in _walkstreamfiles(repo, matcher):
665 repo,
630 if size:
666 includes=includes,
631 ft = _fileappend
667 excludes=excludes,
632 if rl_type & store.FILEFLAGS_VOLATILE:
668 includeobsmarkers=includeobsmarkers,
633 ft = _filefull
669 )
634 entries.append((_srcstore, name, ft, size))
635 totalfilesize += size
636 for name in _walkstreamfullstorefiles(repo):
637 if repo.svfs.exists(name):
638 totalfilesize += repo.svfs.lstat(name).st_size
639 entries.append((_srcstore, name, _filefull, None))
640 if includeobsmarkers and repo.svfs.exists(b'obsstore'):
641 totalfilesize += repo.svfs.lstat(b'obsstore').st_size
642 entries.append((_srcstore, b'obsstore', _filefull, None))
643 for name in cacheutil.cachetocopy(repo):
644 if repo.cachevfs.exists(name):
645 totalfilesize += repo.cachevfs.lstat(name).st_size
646 entries.append((_srccache, name, _filefull, None))
647
670
648 chunks = _emit2(repo, entries, totalfilesize)
671 chunks = _emit2(repo, entries, totalfilesize)
649 first = next(chunks)
672 first = next(chunks)
General Comments 0
You need to be logged in to leave comments. Login now