Show More
@@ -0,0 +1,36 | |||||
|
1 | # configuration related constants | |||
|
2 | ||||
|
3 | from __future__ import annotations | |||
|
4 | ||||
|
5 | from typing import ( | |||
|
6 | List, | |||
|
7 | Tuple, | |||
|
8 | Union, | |||
|
9 | ) | |||
|
10 | ||||
|
11 | # keep typing simple for now | |||
|
12 | ConfigLevelT = str | |||
|
13 | LEVEL_USER = 'user' # "user" is the default level and never passed explicitly | |||
|
14 | LEVEL_LOCAL = 'local' | |||
|
15 | LEVEL_GLOBAL = 'global' | |||
|
16 | LEVEL_SHARED = 'shared' | |||
|
17 | LEVEL_NON_SHARED = 'non_shared' | |||
|
18 | EDIT_LEVELS = ( | |||
|
19 | LEVEL_USER, | |||
|
20 | LEVEL_LOCAL, | |||
|
21 | LEVEL_GLOBAL, | |||
|
22 | LEVEL_SHARED, | |||
|
23 | LEVEL_NON_SHARED, | |||
|
24 | ) | |||
|
25 | ||||
|
26 | ConfigItemT = Tuple[bytes, bytes, bytes, bytes] | |||
|
27 | ResourceIDT = Tuple[bytes, bytes] | |||
|
28 | FileRCT = bytes | |||
|
29 | ComponentT = Tuple[ | |||
|
30 | bytes, | |||
|
31 | Union[ | |||
|
32 | List[ConfigItemT], | |||
|
33 | FileRCT, | |||
|
34 | ResourceIDT, | |||
|
35 | ], | |||
|
36 | ] |
@@ -19,29 +19,24 from .. import ( | |||||
19 | vfs as vfsmod, |
|
19 | vfs as vfsmod, | |
20 | ) |
|
20 | ) | |
21 |
|
21 | |||
22 |
from . import |
|
22 | from . import ( | |
|
23 | ConfigLevelT, | |||
|
24 | EDIT_LEVELS, | |||
|
25 | LEVEL_GLOBAL, | |||
|
26 | LEVEL_LOCAL, | |||
|
27 | LEVEL_NON_SHARED, | |||
|
28 | LEVEL_SHARED, | |||
|
29 | LEVEL_USER, | |||
|
30 | rcutil, | |||
|
31 | ) | |||
23 |
|
32 | |||
24 | EDIT_FLAG = 'edit' |
|
33 | EDIT_FLAG = 'edit' | |
25 |
|
34 | |||
26 |
|
35 | |||
27 | # keep typing simple for now |
|
|||
28 | ConfigLevelT = str |
|
|||
29 | LEVEL_USER = 'user' # "user" is the default level and never passed explicitly |
|
|||
30 | LEVEL_LOCAL = 'local' |
|
|||
31 | LEVEL_GLOBAL = 'global' |
|
|||
32 | LEVEL_SHARED = 'shared' |
|
|||
33 | LEVEL_NON_SHARED = 'non_shared' |
|
|||
34 | EDIT_LEVELS = ( |
|
|||
35 | LEVEL_USER, |
|
|||
36 | LEVEL_LOCAL, |
|
|||
37 | LEVEL_GLOBAL, |
|
|||
38 | LEVEL_SHARED, |
|
|||
39 | LEVEL_NON_SHARED, |
|
|||
40 | ) |
|
|||
41 |
|
||||
42 |
|
||||
43 | def find_edit_level( |
|
36 | def find_edit_level( | |
44 | ui: uimod.ui, repo, opts: Dict[str, Any] |
|
37 | ui: uimod.ui, | |
|
38 | repo, | |||
|
39 | opts: Dict[str, Any], | |||
45 | ) -> Optional[ConfigLevelT]: |
|
40 | ) -> Optional[ConfigLevelT]: | |
46 | """return the level we should edit, if any. |
|
41 | """return the level we should edit, if any. | |
47 |
|
42 |
@@ -13,11 +13,10 from typing import ( | |||||
13 | Dict, |
|
13 | Dict, | |
14 | List, |
|
14 | List, | |
15 | Optional, |
|
15 | Optional, | |
16 | Tuple, |
|
|||
17 | Union, |
|
|||
18 | ) |
|
16 | ) | |
19 |
|
17 | |||
20 | from .. import ( |
|
18 | from .. import ( | |
|
19 | configuration as conf_mod, | |||
21 | encoding, |
|
20 | encoding, | |
22 | localrepo, |
|
21 | localrepo, | |
23 | pycompat, |
|
22 | pycompat, | |
@@ -37,17 +36,10 fallbackpager = scmplatform.fallbackpage | |||||
37 | systemrcpath = scmplatform.systemrcpath |
|
36 | systemrcpath = scmplatform.systemrcpath | |
38 | userrcpath = scmplatform.userrcpath |
|
37 | userrcpath = scmplatform.userrcpath | |
39 |
|
38 | |||
40 | ConfigItemT = Tuple[bytes, bytes, bytes, bytes] |
|
39 | ComponentT = conf_mod.ComponentT | |
41 | ResourceIDT = Tuple[bytes, bytes] |
|
40 | ConfigItemT = conf_mod.ConfigItemT | |
42 | FileRCT = bytes |
|
41 | FileRCT = conf_mod.FileRCT | |
43 | ComponentT = Tuple[ |
|
42 | ResourceIDT = conf_mod.ResourceIDT | |
44 | bytes, |
|
|||
45 | Union[ |
|
|||
46 | List[ConfigItemT], |
|
|||
47 | FileRCT, |
|
|||
48 | ResourceIDT, |
|
|||
49 | ], |
|
|||
50 | ] |
|
|||
51 |
|
43 | |||
52 |
|
44 | |||
53 | def _expandrcpath(path: bytes) -> List[FileRCT]: |
|
45 | def _expandrcpath(path: bytes) -> List[FileRCT]: |
General Comments 0
You need to be logged in to leave comments.
Login now