mercurial/pure/parsers.py
changeset 48264 bb240915f69f
parent 48262 68bb472aee9c
child 48266 749946b6a641
equal deleted inserted replaced
48263:83d0bd45b662 48264:bb240915f69f
    47 # Bits of the `flags` byte inside a node in the file format
    47 # Bits of the `flags` byte inside a node in the file format
    48 DIRSTATE_V2_WDIR_TRACKED = 1 << 0
    48 DIRSTATE_V2_WDIR_TRACKED = 1 << 0
    49 DIRSTATE_V2_P1_TRACKED = 1 << 1
    49 DIRSTATE_V2_P1_TRACKED = 1 << 1
    50 DIRSTATE_V2_P2_INFO = 1 << 2
    50 DIRSTATE_V2_P2_INFO = 1 << 2
    51 DIRSTATE_V2_HAS_MODE_AND_SIZE = 1 << 3
    51 DIRSTATE_V2_HAS_MODE_AND_SIZE = 1 << 3
    52 DIRSTATE_V2_HAS_FILE_MTIME = 1 << 4
    52 DIRSTATE_V2_HAS_MTIME = 1 << 4
    53 _DIRSTATE_V2_HAS_DIRCTORY_MTIME = 1 << 5  # Unused when Rust is not available
    53 DIRSTATE_V2_DIRECTORY = 1 << 5
    54 DIRSTATE_V2_MODE_EXEC_PERM = 1 << 6
    54 DIRSTATE_V2_MODE_EXEC_PERM = 1 << 6
    55 DIRSTATE_V2_MODE_IS_SYMLINK = 1 << 7
    55 DIRSTATE_V2_MODE_IS_SYMLINK = 1 << 7
    56 DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED = 1 << 8
    56 DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED = 1 << 8
    57 DIRSTATE_V2_ALL_UNKNOWN_RECORDED = 1 << 9
    57 DIRSTATE_V2_ALL_UNKNOWN_RECORDED = 1 << 9
    58 DIRSTATE_V2_ALL_IGNORED_RECORDED = 1 << 10
    58 DIRSTATE_V2_ALL_IGNORED_RECORDED = 1 << 10
   138 
   138 
   139     @classmethod
   139     @classmethod
   140     def from_v2_data(cls, flags, size, mtime_s, mtime_ns):
   140     def from_v2_data(cls, flags, size, mtime_s, mtime_ns):
   141         """Build a new DirstateItem object from V2 data"""
   141         """Build a new DirstateItem object from V2 data"""
   142         has_mode_size = bool(flags & DIRSTATE_V2_HAS_MODE_AND_SIZE)
   142         has_mode_size = bool(flags & DIRSTATE_V2_HAS_MODE_AND_SIZE)
   143         has_meaningful_mtime = bool(flags & DIRSTATE_V2_HAS_FILE_MTIME)
   143         has_meaningful_mtime = bool(flags & DIRSTATE_V2_HAS_MTIME)
   144         if flags & DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS:
   144         if flags & DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS:
   145             # The current code is not able to do the more subtle comparison that the
   145             # The current code is not able to do the more subtle comparison that the
   146             # MTIME_SECOND_AMBIGUOUS requires. So we ignore the mtime
   146             # MTIME_SECOND_AMBIGUOUS requires. So we ignore the mtime
   147             has_meaningful_mtime = False
   147             has_meaningful_mtime = False
   148         mode = None
   148         mode = None
   460             if self.mode & stat.S_IXUSR:
   460             if self.mode & stat.S_IXUSR:
   461                 flags |= DIRSTATE_V2_MODE_EXEC_PERM
   461                 flags |= DIRSTATE_V2_MODE_EXEC_PERM
   462             if stat.S_ISLNK(self.mode):
   462             if stat.S_ISLNK(self.mode):
   463                 flags |= DIRSTATE_V2_MODE_IS_SYMLINK
   463                 flags |= DIRSTATE_V2_MODE_IS_SYMLINK
   464         if self._mtime_s is not None:
   464         if self._mtime_s is not None:
   465             flags |= DIRSTATE_V2_HAS_FILE_MTIME
   465             flags |= DIRSTATE_V2_HAS_MTIME
   466 
   466 
   467         if self._fallback_exec is not None:
   467         if self._fallback_exec is not None:
   468             flags |= DIRSTATE_V2_HAS_FALLBACK_EXEC
   468             flags |= DIRSTATE_V2_HAS_FALLBACK_EXEC
   469             if self._fallback_exec:
   469             if self._fallback_exec:
   470                 flags |= DIRSTATE_V2_FALLBACK_EXEC
   470                 flags |= DIRSTATE_V2_FALLBACK_EXEC