mercurial/interfaces/dirstate.py
changeset 51921 382d9629cede
parent 51863 f4733654f144
child 51922 13aa17512583
equal deleted inserted replaced
51920:ef7d85089952 51921:382d9629cede
     1 from __future__ import annotations
     1 from __future__ import annotations
     2 
     2 
     3 import contextlib
     3 import contextlib
     4 
     4 
       
     5 from typing import (
       
     6     Protocol,
       
     7 )
       
     8 
     5 from . import util as interfaceutil
     9 from . import util as interfaceutil
     6 
    10 
     7 
    11 
     8 class idirstate(interfaceutil.Interface):
    12 class idirstate(Protocol):
     9     def __init__(
    13     # TODO: convert these constructor args to fields?
    10         opener,
    14     # def __init__(
    11         ui,
    15     #     self,
    12         root,
    16     #     opener,
    13         validate,
    17     #     ui,
    14         sparsematchfn,
    18     #     root,
    15         nodeconstants,
    19     #     validate,
    16         use_dirstate_v2,
    20     #     sparsematchfn,
    17         use_tracked_hint=False,
    21     #     nodeconstants,
    18     ):
    22     #     use_dirstate_v2,
    19         """Create a new dirstate object.
    23     #     use_tracked_hint=False,
    20 
    24     # ):
    21         opener is an open()-like callable that can be used to open the
    25     #     """Create a new dirstate object.
    22         dirstate file; root is the root of the directory tracked by
    26     #
    23         the dirstate.
    27     #     opener is an open()-like callable that can be used to open the
    24         """
    28     #     dirstate file; root is the root of the directory tracked by
       
    29     #     the dirstate.
       
    30     #     """
    25 
    31 
    26     # TODO: all these private methods and attributes should be made
    32     # TODO: all these private methods and attributes should be made
    27     # public or removed from the interface.
    33     # public or removed from the interface.
    28     _ignore = interfaceutil.Attribute("""Matcher for ignored files.""")
    34     _ignore = interfaceutil.Attribute("""Matcher for ignored files.""")
    29     is_changing_any = interfaceutil.Attribute(
    35     is_changing_any = interfaceutil.Attribute(