##// END OF EJS Templates
dirstate-v2: add a new MTIME_SECOND_AMBIGUOUS flags...
marmoute -
r49080:9205d9be default
parent child Browse files
Show More
@@ -420,6 +420,14 b' static PyObject *dirstate_item_from_v2_m'
420 dirstate_flag_has_meaningful_data |
420 dirstate_flag_has_meaningful_data |
421 dirstate_flag_has_file_mtime);
421 dirstate_flag_has_file_mtime);
422 }
422 }
423 if (t->flags & dirstate_flag_mtime_second_ambiguous) {
424 /* The current code is not able to do the more subtle comparison
425 * that the MTIME_SECOND_AMBIGUOUS requires. So we ignore the
426 * mtime */
427 t->flags &= ~(dirstate_flag_mtime_second_ambiguous |
428 dirstate_flag_has_meaningful_data |
429 dirstate_flag_has_file_mtime);
430 }
423 t->mode = 0;
431 t->mode = 0;
424 if (t->flags & dirstate_flag_has_meaningful_data) {
432 if (t->flags & dirstate_flag_has_meaningful_data) {
425 if (t->flags & dirstate_flag_mode_exec_perm) {
433 if (t->flags & dirstate_flag_mode_exec_perm) {
@@ -47,6 +47,7 b' static const int dirstate_flag_fallback_'
47 static const int dirstate_flag_has_fallback_exec = 1 << 12;
47 static const int dirstate_flag_has_fallback_exec = 1 << 12;
48 static const int dirstate_flag_fallback_symlink = 1 << 13;
48 static const int dirstate_flag_fallback_symlink = 1 << 13;
49 static const int dirstate_flag_has_fallback_symlink = 1 << 14;
49 static const int dirstate_flag_has_fallback_symlink = 1 << 14;
50 static const int dirstate_flag_mtime_second_ambiguous = 1 << 15;
50
51
51 extern PyTypeObject dirstateItemType;
52 extern PyTypeObject dirstateItemType;
52 #define dirstate_tuple_check(op) (Py_TYPE(op) == &dirstateItemType)
53 #define dirstate_tuple_check(op) (Py_TYPE(op) == &dirstateItemType)
@@ -390,6 +390,7 b' Node components are:'
390 FALLBACK_EXEC = 1 << 12
390 FALLBACK_EXEC = 1 << 12
391 HAS_FALLBACK_SYMLINK = 1 << 13
391 HAS_FALLBACK_SYMLINK = 1 << 13
392 FALLBACK_SYMLINK = 1 << 14
392 FALLBACK_SYMLINK = 1 << 14
393 MTIME_SECOND_AMBIGUOUS = 1 << 15
393
394
394 The meaning of each bit is described below.
395 The meaning of each bit is described below.
395
396
@@ -592,3 +593,10 b' by enabling it to skip `readdir` in more'
592 this entry should be considered a symlink if that information cannot be
593 this entry should be considered a symlink if that information cannot be
593 extracted from the file system. If unset it should be considered a normal
594 extracted from the file system. If unset it should be considered a normal
594 file instead.
595 file instead.
596
597 `MTIME_SECOND_AMBIGUOUS`
598 This flag is relevant only when `HAS_FILE_MTIME` is set. When set, the
599 `mtime` stored in the entry is only valid for comparison with timestamps
600 that have nanosecond information. If available timestamp does not carries
601 nanosecond information, the `mtime` should be ignored and no optimisation
602 can be applied.
@@ -60,6 +60,7 b' DIRSTATE_V2_HAS_FALLBACK_EXEC = 1 << 11'
60 DIRSTATE_V2_FALLBACK_EXEC = 1 << 12
60 DIRSTATE_V2_FALLBACK_EXEC = 1 << 12
61 DIRSTATE_V2_HAS_FALLBACK_SYMLINK = 1 << 13
61 DIRSTATE_V2_HAS_FALLBACK_SYMLINK = 1 << 13
62 DIRSTATE_V2_FALLBACK_SYMLINK = 1 << 14
62 DIRSTATE_V2_FALLBACK_SYMLINK = 1 << 14
63 DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS = 1 << 15
63
64
64
65
65 @attr.s(slots=True, init=False)
66 @attr.s(slots=True, init=False)
@@ -140,6 +141,10 b' class DirstateItem(object):'
140 """Build a new DirstateItem object from V2 data"""
141 """Build a new DirstateItem object from V2 data"""
141 has_mode_size = bool(flags & DIRSTATE_V2_HAS_MODE_AND_SIZE)
142 has_mode_size = bool(flags & DIRSTATE_V2_HAS_MODE_AND_SIZE)
142 has_meaningful_mtime = bool(flags & DIRSTATE_V2_HAS_FILE_MTIME)
143 has_meaningful_mtime = bool(flags & DIRSTATE_V2_HAS_FILE_MTIME)
144 if flags & DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS:
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
147 has_meaningful_mtime = False
143 mode = None
148 mode = None
144
149
145 if flags & +DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED:
150 if flags & +DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED:
@@ -117,6 +117,7 b' bitflags! {'
117 const FALLBACK_EXEC = 1 << 12;
117 const FALLBACK_EXEC = 1 << 12;
118 const HAS_FALLBACK_SYMLINK = 1 << 13;
118 const HAS_FALLBACK_SYMLINK = 1 << 13;
119 const FALLBACK_SYMLINK = 1 << 14;
119 const FALLBACK_SYMLINK = 1 << 14;
120 const MTIME_SECOND_AMBIGUOUS = 1 << 15;
120 }
121 }
121 }
122 }
122
123
@@ -371,6 +372,9 b' impl Node {'
371 };
372 };
372 let mtime = if self.flags().contains(Flags::HAS_FILE_MTIME)
373 let mtime = if self.flags().contains(Flags::HAS_FILE_MTIME)
373 && !self.flags().contains(Flags::EXPECTED_STATE_IS_MODIFIED)
374 && !self.flags().contains(Flags::EXPECTED_STATE_IS_MODIFIED)
375 // The current code is not able to do the more subtle comparison that the
376 // MTIME_SECOND_AMBIGUOUS requires. So we ignore the mtime
377 && !self.flags().contains(Flags::MTIME_SECOND_AMBIGUOUS)
374 {
378 {
375 // TODO: replace this by `self.mtime.try_into()?` to use
379 // TODO: replace this by `self.mtime.try_into()?` to use
376 // sub-second precision from the file.
380 // sub-second precision from the file.
General Comments 0
You need to be logged in to leave comments. Login now