mercurial/configuration/command.py
changeset 52425 3e79ca017157
parent 52419 04c3fb885fb6
child 52426 22129ce9f86d
equal deleted inserted replaced
52424:e3b45916c375 52425:3e79ca017157
    17     ui as uimod,
    17     ui as uimod,
    18     util,
    18     util,
    19     vfs as vfsmod,
    19     vfs as vfsmod,
    20 )
    20 )
    21 
    21 
    22 from . import rcutil
    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 
    48     Parse the command option to detect when an edit is requested, and if so the
    43     Parse the command option to detect when an edit is requested, and if so the
    49     configuration level we should edit.
    44     configuration level we should edit.