def _gen_options(self): # type: () -> bytes from edenscm.hgext.remotefilelog import shallowutil, constants repo_name = getattr(self.repo, "name", None) use_treemanifest = (self.treemanifest is not None) and bool(repo_name) use_mononoke = use_treemanifest and self._is_mononoke_supported( repo_name) flags = 0 treemanifest_paths = [] if use_treemanifest: flags |= START_FLAGS_TREEMANIFEST_SUPPORTED treemanifest_paths = [ shallowutil.getlocalpackpath(self.repo.svfs.join(""), constants.TREEPACK_CATEGORY), shallowutil.getcachepackpath(self.repo, constants.TREEPACK_CATEGORY), shallowutil.getlocalpackpath(self.repo.svfs.join(""), constants.FILEPACK_CATEGORY), shallowutil.getcachepackpath(self.repo, constants.FILEPACK_CATEGORY), ] if use_mononoke: flags |= START_FLAGS_MONONOKE_SUPPORTED flags |= START_FLAGS_CAT_TREE_SUPPORTED flags |= START_FLAGS_FLUSH_STORE_SUPPORTED # Options format: # - Protocol version number # - Is treemanifest supported? # - Number of treemanifest paths # - treemanifest paths, encoded as (length, string_data) parts = [] parts.append( struct.pack(">III", PROTOCOL_VERSION, flags, len(treemanifest_paths))) for path in treemanifest_paths: parts.append(struct.pack(">I", len(path))) parts.append(pycompat.encodeutf8(path)) if use_mononoke: parts.append(struct.pack(">I", len(repo_name))) parts.append(pycompat.encodeutf8(repo_name)) return b"".join(parts)
def _gen_options(self): repo_name = getattr(self.repo, "name", None) use_treemanifest = (self.treemanifest is not None) and bool(repo_name) use_mononoke = use_treemanifest and self._is_mononoke_supported( repo_name) flags = 0 treemanifest_paths = [] if use_treemanifest: flags |= START_FLAGS_TREEMANIFEST_SUPPORTED treemanifest_paths = [ shallowutil.getlocalpackpath(self.repo.svfs.vfs.base, constants.TREEPACK_CATEGORY), shallowutil.getcachepackpath(self.repo, constants.TREEPACK_CATEGORY), shallowutil.getlocalpackpath(self.repo.svfs.vfs.base, constants.FILEPACK_CATEGORY), shallowutil.getcachepackpath(self.repo, constants.FILEPACK_CATEGORY), ] if use_mononoke: flags |= START_FLAGS_MONONOKE_SUPPORTED # Options format: # - Protocol version number # - Is treemanifest supported? # - Number of treemanifest paths # - treemanifest paths, encoded as (length, string_data) parts = [] parts.append( struct.pack(b">III", PROTOCOL_VERSION, flags, len(treemanifest_paths))) for path in treemanifest_paths: parts.append(struct.pack(b">I", len(path))) parts.append(path) if use_mononoke: parts.append(struct.pack(b">I", len(repo_name))) parts.append(repo_name) return "".join(parts)
def _gen_options(self): repo_name = getattr(self.repo, "name", None) use_treemanifest = (self.treemanifest is not None) and bool(repo_name) use_mononoke = use_treemanifest and self._is_mononoke_supported(repo_name) flags = 0 treemanifest_paths = [] if use_treemanifest: flags |= START_FLAGS_TREEMANIFEST_SUPPORTED treemanifest_paths = [ shallowutil.getlocalpackpath( self.repo.svfs.vfs.base, constants.TREEPACK_CATEGORY ), shallowutil.getcachepackpath(self.repo, constants.TREEPACK_CATEGORY), shallowutil.getlocalpackpath( self.repo.svfs.vfs.base, constants.FILEPACK_CATEGORY ), shallowutil.getcachepackpath(self.repo, constants.FILEPACK_CATEGORY), ] if use_mononoke: flags |= START_FLAGS_MONONOKE_SUPPORTED # Options format: # - Protocol version number # - Is treemanifest supported? # - Number of treemanifest paths # - treemanifest paths, encoded as (length, string_data) parts = [] parts.append( struct.pack(b">III", PROTOCOL_VERSION, flags, len(treemanifest_paths)) ) for path in treemanifest_paths: parts.append(struct.pack(b">I", len(path))) parts.append(path) if use_mononoke: parts.append(struct.pack(b">I", len(repo_name))) parts.append(repo_name) return "".join(parts)