mercurial/interfaces/repository.py
changeset 52463 0cfcc276b796
parent 52462 fb3144d35361
child 52464 73a46cef57c9
equal deleted inserted replaced
52462:fb3144d35361 52463:0cfcc276b796
     6 # This software may be used and distributed according to the terms of the
     6 # This software may be used and distributed according to the terms of the
     7 # GNU General Public License version 2 or any later version.
     7 # GNU General Public License version 2 or any later version.
     8 
     8 
     9 from __future__ import annotations
     9 from __future__ import annotations
    10 
    10 
       
    11 import typing
       
    12 
    11 from typing import (
    13 from typing import (
       
    14     Any,
    12     Protocol,
    15     Protocol,
    13 )
    16 )
    14 
    17 
    15 from ..i18n import _
    18 from ..i18n import _
    16 from .. import error
    19 from .. import error
    17 from . import util as interfaceutil
    20 from . import util as interfaceutil
       
    21 
       
    22 if typing.TYPE_CHECKING:
       
    23     # Almost all mercurial modules are only imported in the type checking phase
       
    24     # to avoid circular imports
       
    25     from ..utils import (
       
    26         urlutil,
       
    27     )
       
    28 
       
    29     # TODO: create a Protocol class, since importing uimod here causes a cycle
       
    30     #  that confuses pytype.
       
    31     Ui = Any
    18 
    32 
    19 # Local repository feature string.
    33 # Local repository feature string.
    20 
    34 
    21 # Revlogs are being used for file storage.
    35 # Revlogs are being used for file storage.
    22 REPO_FEATURE_REVLOG_FILE_STORAGE = b'revlogfilestorage'
    36 REPO_FEATURE_REVLOG_FILE_STORAGE = b'revlogfilestorage'
   110 
   124 
   111     This is not a complete interface definition and should not be used
   125     This is not a complete interface definition and should not be used
   112     outside of this module.
   126     outside of this module.
   113     """
   127     """
   114 
   128 
   115     ui = interfaceutil.Attribute("""ui.ui instance""")
   129     ui: Ui
   116     path = interfaceutil.Attribute("""a urlutil.path instance or None""")
   130     """ui.ui instance"""
       
   131 
       
   132     path: urlutil.path | None
       
   133     """a urlutil.path instance or None"""
   117 
   134 
   118     def url(self):
   135     def url(self):
   119         """Returns a URL string representing this peer.
   136         """Returns a URL string representing this peer.
   120 
   137 
   121         Currently, implementations expose the raw URL used to construct the
   138         Currently, implementations expose the raw URL used to construct the