mercurial/pure/parsers.py
changeset 48402 be2317167a9b
parent 48401 995aaacb12d7
child 48496 30741bbea550
equal deleted inserted replaced
48401:995aaacb12d7 48402:be2317167a9b
   147     @classmethod
   147     @classmethod
   148     def from_v2_data(cls, flags, size, mtime_s, mtime_ns):
   148     def from_v2_data(cls, flags, size, mtime_s, mtime_ns):
   149         """Build a new DirstateItem object from V2 data"""
   149         """Build a new DirstateItem object from V2 data"""
   150         has_mode_size = bool(flags & DIRSTATE_V2_HAS_MODE_AND_SIZE)
   150         has_mode_size = bool(flags & DIRSTATE_V2_HAS_MODE_AND_SIZE)
   151         has_meaningful_mtime = bool(flags & DIRSTATE_V2_HAS_MTIME)
   151         has_meaningful_mtime = bool(flags & DIRSTATE_V2_HAS_MTIME)
   152         if flags & DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS:
       
   153             # The current code is not able to do the more subtle comparison that the
       
   154             # MTIME_SECOND_AMBIGUOUS requires. So we ignore the mtime
       
   155             has_meaningful_mtime = False
       
   156         mode = None
   152         mode = None
   157 
   153 
   158         if flags & +DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED:
   154         if flags & +DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED:
   159             # we do not have support for this flag in the code yet,
   155             # we do not have support for this flag in the code yet,
   160             # force a lookup for this file.
   156             # force a lookup for this file.
   177                 mode = 0o644
   173                 mode = 0o644
   178             if flags & DIRSTATE_V2_MODE_IS_SYMLINK:
   174             if flags & DIRSTATE_V2_MODE_IS_SYMLINK:
   179                 mode |= stat.S_IFLNK
   175                 mode |= stat.S_IFLNK
   180             else:
   176             else:
   181                 mode |= stat.S_IFREG
   177                 mode |= stat.S_IFREG
       
   178 
       
   179         second_ambiguous = flags & DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS
   182         return cls(
   180         return cls(
   183             wc_tracked=bool(flags & DIRSTATE_V2_WDIR_TRACKED),
   181             wc_tracked=bool(flags & DIRSTATE_V2_WDIR_TRACKED),
   184             p1_tracked=bool(flags & DIRSTATE_V2_P1_TRACKED),
   182             p1_tracked=bool(flags & DIRSTATE_V2_P1_TRACKED),
   185             p2_info=bool(flags & DIRSTATE_V2_P2_INFO),
   183             p2_info=bool(flags & DIRSTATE_V2_P2_INFO),
   186             has_meaningful_data=has_mode_size,
   184             has_meaningful_data=has_mode_size,
   187             has_meaningful_mtime=has_meaningful_mtime,
   185             has_meaningful_mtime=has_meaningful_mtime,
   188             parentfiledata=(mode, size, (mtime_s, mtime_ns, False)),
   186             parentfiledata=(mode, size, (mtime_s, mtime_ns, second_ambiguous)),
   189             fallback_exec=fallback_exec,
   187             fallback_exec=fallback_exec,
   190             fallback_symlink=fallback_symlink,
   188             fallback_symlink=fallback_symlink,
   191         )
   189         )
   192 
   190 
   193     @classmethod
   191     @classmethod