mercurial/pure/parsers.py
changeset 47566 3df817387ea3
parent 47540 1a6302427eb9
child 47569 7a4ba68f2373
equal deleted inserted replaced
47565:00ae1fb6c459 47566:3df817387ea3
    12 
    12 
    13 from ..node import (
    13 from ..node import (
    14     nullrev,
    14     nullrev,
    15     sha1nodeconstants,
    15     sha1nodeconstants,
    16 )
    16 )
       
    17 from ..thirdparty import attr
    17 from .. import (
    18 from .. import (
    18     error,
    19     error,
    19     pycompat,
    20     pycompat,
    20     revlogutils,
    21     revlogutils,
    21     util,
    22     util,
    41 
    42 
    42 # a special value used internally for `time` if the time is ambigeous
    43 # a special value used internally for `time` if the time is ambigeous
    43 AMBIGUOUS_TIME = -1
    44 AMBIGUOUS_TIME = -1
    44 
    45 
    45 
    46 
       
    47 @attr.s(slots=True)
    46 class DirstateItem(object):
    48 class DirstateItem(object):
    47     """represent a dirstate entry
    49     """represent a dirstate entry
    48 
    50 
    49     It contains:
    51     It contains:
    50 
    52 
    52     - mode,
    54     - mode,
    53     - size,
    55     - size,
    54     - mtime,
    56     - mtime,
    55     """
    57     """
    56 
    58 
    57     __slot__ = ('_state', '_mode', '_size', '_mtime')
    59     _state = attr.ib()
    58 
    60     _mode = attr.ib()
    59     def __init__(self, state, mode, size, mtime):
    61     _size = attr.ib()
    60         self._state = state
    62     _mtime = attr.ib()
    61         self._mode = mode
       
    62         self._size = size
       
    63         self._mtime = mtime
       
    64 
    63 
    65     def __getitem__(self, idx):
    64     def __getitem__(self, idx):
    66         if idx == 0 or idx == -4:
    65         if idx == 0 or idx == -4:
    67             return self._state
    66             return self._state
    68         elif idx == 1 or idx == -3:
    67         elif idx == 1 or idx == -3: