view mercurial/configuration/__init__.py @ 53040:cdd7bf612c7b stable tip

bundle-spec: properly format boolean parameter (issue6960) This was breaking automatic clone bundle generation. This changeset fixes it and add a test to catch it in the future.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 11 Mar 2025 02:29:42 +0100
parents 8c509a70b6fa
children
line wrap: on
line source

# configuration related constants

from __future__ import annotations

from typing import (
    List,
    Tuple,
    Union,
)

# keep typing simple for now
ConfigLevelT = str
LEVEL_BUNDLED_RESOURCE = 'RESOURCE'
LEVEL_ENV_OVERWRITE = 'ENV-HGRCPATH'
LEVEL_USER = 'user'
LEVEL_LOCAL = 'local'
LEVEL_GLOBAL = 'global'
LEVEL_SHARED = 'shared'
LEVEL_NON_SHARED = 'non_shared'
# only include level that it make sense to edit
# note: "user" is the default level and never passed explicitly
EDIT_LEVELS = (
    LEVEL_USER,
    LEVEL_LOCAL,
    LEVEL_GLOBAL,
    LEVEL_SHARED,
    LEVEL_NON_SHARED,
)
# levels that can works without a repository
NO_REPO_EDIT_LEVELS = (
    LEVEL_USER,
    LEVEL_GLOBAL,
)

ConfigItemT = Tuple[bytes, bytes, bytes, bytes]
ResourceIDT = Tuple[bytes, bytes]
FileRCT = bytes
ComponentT = Tuple[
    ConfigLevelT,
    bytes,
    Union[
        List[ConfigItemT],
        FileRCT,
        ResourceIDT,
    ],
]