annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
52456
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
1 # configuration related constants
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
2
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
3 from __future__ import annotations
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
4
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
5 from typing import (
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
6 List,
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
7 Tuple,
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
8 Union,
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
9 )
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
10
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
11 # keep typing simple for now
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
12 ConfigLevelT = str
52457
22129ce9f86d config: include the component level when returning them
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52456
diff changeset
13 LEVEL_BUNDLED_RESOURCE = 'RESOURCE'
22129ce9f86d config: include the component level when returning them
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52456
diff changeset
14 LEVEL_ENV_OVERWRITE = 'ENV-HGRCPATH'
22129ce9f86d config: include the component level when returning them
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52456
diff changeset
15 LEVEL_USER = 'user'
52456
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
16 LEVEL_LOCAL = 'local'
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
17 LEVEL_GLOBAL = 'global'
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
18 LEVEL_SHARED = 'shared'
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
19 LEVEL_NON_SHARED = 'non_shared'
52457
22129ce9f86d config: include the component level when returning them
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52456
diff changeset
20 # only include level that it make sense to edit
22129ce9f86d config: include the component level when returning them
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52456
diff changeset
21 # note: "user" is the default level and never passed explicitly
52456
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
22 EDIT_LEVELS = (
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
23 LEVEL_USER,
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
24 LEVEL_LOCAL,
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
25 LEVEL_GLOBAL,
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
26 LEVEL_SHARED,
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
27 LEVEL_NON_SHARED,
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
28 )
52458
8c509a70b6fa config: gather the path to edit through rcutil
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52457
diff changeset
29 # levels that can works without a repository
8c509a70b6fa config: gather the path to edit through rcutil
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52457
diff changeset
30 NO_REPO_EDIT_LEVELS = (
8c509a70b6fa config: gather the path to edit through rcutil
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52457
diff changeset
31 LEVEL_USER,
8c509a70b6fa config: gather the path to edit through rcutil
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52457
diff changeset
32 LEVEL_GLOBAL,
8c509a70b6fa config: gather the path to edit through rcutil
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52457
diff changeset
33 )
52456
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
34
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
35 ConfigItemT = Tuple[bytes, bytes, bytes, bytes]
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
36 ResourceIDT = Tuple[bytes, bytes]
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
37 FileRCT = bytes
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
38 ComponentT = Tuple[
52457
22129ce9f86d config: include the component level when returning them
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52456
diff changeset
39 ConfigLevelT,
52456
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
40 bytes,
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
41 Union[
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
42 List[ConfigItemT],
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
43 FileRCT,
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
44 ResourceIDT,
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
45 ],
3e79ca017157 config: gather constant and type into the `__init__.py`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 52447
diff changeset
46 ]