hgext/remotenames.py
changeset 49292 33872fec41e7
parent 48946 642e31cb55f0
child 50790 5ac5f16277a9
equal deleted inserted replaced
49291:1bf3eb65e970 49292:33872fec41e7
    23   Name of the peer whose remotebookmarks should be hoisted into the top-level
    23   Name of the peer whose remotebookmarks should be hoisted into the top-level
    24   namespace (default: 'default')
    24   namespace (default: 'default')
    25 """
    25 """
    26 
    26 
    27 
    27 
       
    28 import collections.abc
       
    29 
    28 from mercurial.i18n import _
    30 from mercurial.i18n import _
    29 
    31 
    30 from mercurial.node import bin
    32 from mercurial.node import bin
    31 from mercurial import (
    33 from mercurial import (
    32     bookmarks,
    34     bookmarks,
    33     error,
    35     error,
    34     extensions,
    36     extensions,
    35     logexchange,
    37     logexchange,
    36     namespaces,
    38     namespaces,
    37     pycompat,
       
    38     registrar,
    39     registrar,
    39     revsetlang,
    40     revsetlang,
    40     smartset,
    41     smartset,
    41     templateutil,
    42     templateutil,
    42     util,
    43     util,
    43 )
    44 )
    44 
    45 
    45 from mercurial.utils import stringutil
    46 from mercurial.utils import stringutil
    46 
       
    47 if pycompat.ispy3:
       
    48     import collections.abc
       
    49 
       
    50     mutablemapping = collections.abc.MutableMapping
       
    51 else:
       
    52     import collections
       
    53 
       
    54     mutablemapping = collections.MutableMapping
       
    55 
    47 
    56 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
    48 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
    57 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
    49 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
    58 # be specifying the version(s) of Mercurial they are tested with, or
    50 # be specifying the version(s) of Mercurial they are tested with, or
    59 # leave the attribute unspecified.
    51 # leave the attribute unspecified.
    79     b'hoistedpeer',
    71     b'hoistedpeer',
    80     default=b'default',
    72     default=b'default',
    81 )
    73 )
    82 
    74 
    83 
    75 
    84 class lazyremotenamedict(mutablemapping):
    76 class lazyremotenamedict(collections.abc.MutableMapping):
    85     """
    77     """
    86     Read-only dict-like Class to lazily resolve remotename entries
    78     Read-only dict-like Class to lazily resolve remotename entries
    87 
    79 
    88     We are doing that because remotenames startup was slow.
    80     We are doing that because remotenames startup was slow.
    89     We lazily read the remotenames file once to figure out the potential entries
    81     We lazily read the remotenames file once to figure out the potential entries