mercurial/dirstatemap.py
changeset 48120 fe6617715464
parent 48119 aec5b0981c26
child 48121 5fc2dfb073d6
equal deleted inserted replaced
48119:aec5b0981c26 48120:fe6617715464
    39     """
    39     """
    40     Methods that are identical for both implementations of the dirstatemap
    40     Methods that are identical for both implementations of the dirstatemap
    41     class, with and without Rust extensions enabled.
    41     class, with and without Rust extensions enabled.
    42     """
    42     """
    43 
    43 
       
    44     def __init__(self, ui, opener, root, nodeconstants, use_dirstate_v2):
       
    45         self._use_dirstate_v2 = use_dirstate_v2
       
    46         self._nodeconstants = nodeconstants
       
    47         self._ui = ui
       
    48         self._opener = opener
       
    49         self._root = root
       
    50         self._filename = b'dirstate'
       
    51         self._nodelen = 20  # Also update Rust code when changing this!
       
    52         self._parents = None
       
    53         self._dirtyparents = False
       
    54 
       
    55         # for consistent view between _pl() and _read() invocations
       
    56         self._pendingmode = None
       
    57 
    44 
    58 
    45 class dirstatemap(_dirstatemapcommon):
    59 class dirstatemap(_dirstatemapcommon):
    46     """Map encapsulating the dirstate's contents.
    60     """Map encapsulating the dirstate's contents.
    47 
    61 
    48     The dirstate contains the following state:
    62     The dirstate contains the following state:
    75     - `dirfoldmap` is a dict mapping normalized directory names to the
    89     - `dirfoldmap` is a dict mapping normalized directory names to the
    76       denormalized form that they appear as in the dirstate.
    90       denormalized form that they appear as in the dirstate.
    77     """
    91     """
    78 
    92 
    79     def __init__(self, ui, opener, root, nodeconstants, use_dirstate_v2):
    93     def __init__(self, ui, opener, root, nodeconstants, use_dirstate_v2):
    80         self._ui = ui
    94         super(dirstatemap, self).__init__(
    81         self._opener = opener
    95             ui, opener, root, nodeconstants, use_dirstate_v2
    82         self._root = root
    96         )
    83         self._filename = b'dirstate'
    97         if self._use_dirstate_v2:
    84         self._nodelen = 20
    98             msg = "Dirstate V2 not supportedi"
    85         self._nodeconstants = nodeconstants
    99             msg += "(should have detected unsupported requirement)"
    86         assert (
   100             raise error.ProgrammingError(msg)
    87             not use_dirstate_v2
       
    88         ), "should have detected unsupported requirement"
       
    89 
       
    90         self._parents = None
       
    91         self._dirtyparents = False
       
    92 
       
    93         # for consistent view between _pl() and _read() invocations
       
    94         self._pendingmode = None
       
    95 
   101 
    96     @propertycache
   102     @propertycache
    97     def _map(self):
   103     def _map(self):
    98         self._map = {}
   104         self._map = {}
    99         self.read()
   105         self.read()
   467 
   473 
   468 if rustmod is not None:
   474 if rustmod is not None:
   469 
   475 
   470     class dirstatemap(_dirstatemapcommon):
   476     class dirstatemap(_dirstatemapcommon):
   471         def __init__(self, ui, opener, root, nodeconstants, use_dirstate_v2):
   477         def __init__(self, ui, opener, root, nodeconstants, use_dirstate_v2):
   472             self._use_dirstate_v2 = use_dirstate_v2
   478             super(dirstatemap, self).__init__(
   473             self._nodeconstants = nodeconstants
   479                 ui, opener, root, nodeconstants, use_dirstate_v2
   474             self._ui = ui
   480             )
   475             self._opener = opener
       
   476             self._root = root
       
   477             self._filename = b'dirstate'
       
   478             self._nodelen = 20  # Also update Rust code when changing this!
       
   479             self._parents = None
       
   480             self._dirtyparents = False
       
   481             self._docket = None
   481             self._docket = None
   482 
       
   483             # for consistent view between _pl() and _read() invocations
       
   484             self._pendingmode = None
       
   485 
   482 
   486         def addfile(
   483         def addfile(
   487             self,
   484             self,
   488             f,
   485             f,
   489             mode=0,
   486             mode=0,