mercurial/streamclone.py
changeset 52696 10e7adbffa8c
parent 52695 f5471af96a52
child 52700 061bfd699a56
equal deleted inserted replaced
52695:f5471af96a52 52696:10e7adbffa8c
   363     compressed in the future).
   363     compressed in the future).
   364 
   364 
   365     Returns a tuple of (requirements, data generator).
   365     Returns a tuple of (requirements, data generator).
   366     """
   366     """
   367     if compression != b'UN':
   367     if compression != b'UN':
   368         raise ValueError(b'we do not support the compression argument yet')
   368         raise ValueError('we do not support the compression argument yet')
   369 
   369 
   370     requirements = streamed_requirements(repo)
   370     requirements = streamed_requirements(repo)
   371     requires = b','.join(sorted(requirements))
   371     requires = b','.join(sorted(requirements))
   372 
   372 
   373     def gen() -> Iterator[bytes]:
   373     def gen() -> Iterator[bytes]:
   726     #
   726     #
   727     # this assert is duplicated (from _makemap) as author might think this is
   727     # this assert is duplicated (from _makemap) as author might think this is
   728     # fine, while this is really not fine.
   728     # fine, while this is really not fine.
   729     if repo.vfs in vfsmap.values():
   729     if repo.vfs in vfsmap.values():
   730         raise error.ProgrammingError(
   730         raise error.ProgrammingError(
   731             b'repo.vfs must not be added to vfsmap for security reasons'
   731             'repo.vfs must not be added to vfsmap for security reasons'
   732         )
   732         )
   733 
   733 
   734     # translate the vfs one
   734     # translate the vfs one
   735     entries = [(vfs_key, vfsmap[vfs_key], e) for (vfs_key, e) in entries]
   735     entries = [(vfs_key, vfsmap[vfs_key], e) for (vfs_key, e) in entries]
   736     _test_sync_point_walk_1_2(repo)
   736     _test_sync_point_walk_1_2(repo)
   793     #
   793     #
   794     # this assert is duplicated (from _makemap) as authors might think this is
   794     # this assert is duplicated (from _makemap) as authors might think this is
   795     # fine, while this is really not fine.
   795     # fine, while this is really not fine.
   796     if repo.vfs in vfsmap.values():
   796     if repo.vfs in vfsmap.values():
   797         raise error.ProgrammingError(
   797         raise error.ProgrammingError(
   798             b'repo.vfs must not be added to vfsmap for security reasons'
   798             'repo.vfs must not be added to vfsmap for security reasons'
   799         )
   799         )
   800 
   800 
   801     # translate the vfs once
   801     # translate the vfs once
   802     # we only turn this into a list for the `_test_sync`, this is not ideal
   802     # we only turn this into a list for the `_test_sync`, this is not ideal
   803     base_entries = list(entries)
   803     base_entries = list(entries)
  1072         #
  1072         #
  1073         # this assert is duplicated (from _makemap) as author might think this
  1073         # this assert is duplicated (from _makemap) as author might think this
  1074         # is fine, while this is really not fine.
  1074         # is fine, while this is really not fine.
  1075         if repo.vfs in vfsmap.values():
  1075         if repo.vfs in vfsmap.values():
  1076             raise error.ProgrammingError(
  1076             raise error.ProgrammingError(
  1077                 b'repo.vfs must not be added to vfsmap for security reasons'
  1077                 'repo.vfs must not be added to vfsmap for security reasons'
  1078             )
  1078             )
  1079 
  1079 
  1080         with repo.transaction(b'clone'):
  1080         with repo.transaction(b'clone'):
  1081             ctxs = (vfs.backgroundclosing(repo.ui) for vfs in vfsmap.values())
  1081             ctxs = (vfs.backgroundclosing(repo.ui) for vfs in vfsmap.values())
  1082             with nested(*ctxs):
  1082             with nested(*ctxs):
  1143         #
  1143         #
  1144         # this assert is duplicated (from _makemap) as authors might think this
  1144         # this assert is duplicated (from _makemap) as authors might think this
  1145         # is fine, while this is really not fine.
  1145         # is fine, while this is really not fine.
  1146         if repo.vfs in vfsmap.values():
  1146         if repo.vfs in vfsmap.values():
  1147             raise error.ProgrammingError(
  1147             raise error.ProgrammingError(
  1148                 b'repo.vfs must not be added to vfsmap for security reasons'
  1148                 'repo.vfs must not be added to vfsmap for security reasons'
  1149             )
  1149             )
  1150 
  1150 
  1151         with repo.transaction(b'clone'):
  1151         with repo.transaction(b'clone'):
  1152             ctxs = (vfs.backgroundclosing(repo.ui) for vfs in vfsmap.values())
  1152             ctxs = (vfs.backgroundclosing(repo.ui) for vfs in vfsmap.values())
  1153             with nested(*ctxs):
  1153             with nested(*ctxs):