Show More
@@ -116,7 +116,6 b' class dirstate(object):' | |||
|
116 | 116 | # UNC path pointing to root share (issue4557) |
|
117 | 117 | self._rootdir = pathutil.normasprefix(root) |
|
118 | 118 | self._dirty = False |
|
119 | self._lastnormaltime = timestamp.zero() | |
|
120 | 119 | self._ui = ui |
|
121 | 120 | self._filecache = {} |
|
122 | 121 | self._parentwriters = 0 |
@@ -430,7 +429,6 b' class dirstate(object):' | |||
|
430 | 429 | for a in ("_map", "_branch", "_ignore"): |
|
431 | 430 | if a in self.__dict__: |
|
432 | 431 | delattr(self, a) |
|
433 | self._lastnormaltime = timestamp.zero() | |
|
434 | 432 | self._dirty = False |
|
435 | 433 | self._parentwriters = 0 |
|
436 | 434 | self._origpl = None |
@@ -493,11 +491,6 b' class dirstate(object):' | |||
|
493 | 491 | self._check_new_tracked_filename(filename) |
|
494 | 492 | (mode, size, mtime) = parentfiledata |
|
495 | 493 | self._map.set_clean(filename, mode, size, mtime) |
|
496 | if mtime > self._lastnormaltime: | |
|
497 | # Remember the most recent modification timeslot for status(), | |
|
498 | # to make sure we won't miss future size-preserving file content | |
|
499 | # modifications that happen within the same timeslot. | |
|
500 | self._lastnormaltime = mtime | |
|
501 | 494 | |
|
502 | 495 | @requires_no_parents_change |
|
503 | 496 | def set_possibly_dirty(self, filename): |
@@ -581,15 +574,6 b' class dirstate(object):' | |||
|
581 | 574 | has_meaningful_mtime=not possibly_dirty, |
|
582 | 575 | parentfiledata=parentfiledata, |
|
583 | 576 | ) |
|
584 | if ( | |
|
585 | parentfiledata is not None | |
|
586 | and parentfiledata[2] is not None | |
|
587 | and parentfiledata[2] > self._lastnormaltime | |
|
588 | ): | |
|
589 | # Remember the most recent modification timeslot for status(), | |
|
590 | # to make sure we won't miss future size-preserving file content | |
|
591 | # modifications that happen within the same timeslot. | |
|
592 | self._lastnormaltime = parentfiledata[2] | |
|
593 | 577 | |
|
594 | 578 | def _check_new_tracked_filename(self, filename): |
|
595 | 579 | scmutil.checkfilename(filename) |
@@ -693,7 +677,6 b' class dirstate(object):' | |||
|
693 | 677 | |
|
694 | 678 | def clear(self): |
|
695 | 679 | self._map.clear() |
|
696 | self._lastnormaltime = timestamp.zero() | |
|
697 | 680 | self._dirty = True |
|
698 | 681 | |
|
699 | 682 | def rebuild(self, parent, allfiles, changedfiles=None): |
@@ -701,9 +684,7 b' class dirstate(object):' | |||
|
701 | 684 | # Rebuild entire dirstate |
|
702 | 685 | to_lookup = allfiles |
|
703 | 686 | to_drop = [] |
|
704 | lastnormaltime = self._lastnormaltime | |
|
705 | 687 | self.clear() |
|
706 | self._lastnormaltime = lastnormaltime | |
|
707 | 688 | elif len(changedfiles) < 10: |
|
708 | 689 | # Avoid turning allfiles into a set, which can be expensive if it's |
|
709 | 690 | # large. |
@@ -818,7 +799,6 b' class dirstate(object):' | |||
|
818 | 799 | break |
|
819 | 800 | |
|
820 | 801 | self._map.write(tr, st, now) |
|
821 | self._lastnormaltime = timestamp.zero() | |
|
822 | 802 | self._dirty = False |
|
823 | 803 | |
|
824 | 804 | def _dirignore(self, f): |
@@ -1216,7 +1196,6 b' class dirstate(object):' | |||
|
1216 | 1196 | self._rootdir, |
|
1217 | 1197 | self._ignorefiles(), |
|
1218 | 1198 | self._checkexec, |
|
1219 | self._lastnormaltime, | |
|
1220 | 1199 | bool(list_clean), |
|
1221 | 1200 | bool(list_ignored), |
|
1222 | 1201 | bool(list_unknown), |
@@ -1343,7 +1322,6 b' class dirstate(object):' | |||
|
1343 | 1322 | checkexec = self._checkexec |
|
1344 | 1323 | checklink = self._checklink |
|
1345 | 1324 | copymap = self._map.copymap |
|
1346 | lastnormaltime = self._lastnormaltime | |
|
1347 | 1325 | |
|
1348 | 1326 | # We need to do full walks when either |
|
1349 | 1327 | # - we're listing all clean files, or |
@@ -1399,12 +1377,10 b' class dirstate(object):' | |||
|
1399 | 1377 | else: |
|
1400 | 1378 | madd(fn) |
|
1401 | 1379 | elif not t.mtime_likely_equal_to(timestamp.mtime_of(st)): |
|
1402 | ladd(fn) | |
|
1403 | elif timestamp.mtime_of(st) == lastnormaltime: | |
|
1404 | # fn may have just been marked as normal and it may have | |
|
1405 | # changed in the same second without changing its size. | |
|
1406 | # This can happen if we quickly do multiple commits. | |
|
1407 | # Force lookup, so we don't miss such a racy file change. | |
|
1380 | # There might be a change in the future if for example the | |
|
1381 | # internal clock is off, but this is a case where the issues | |
|
1382 | # the user would face would be a lot worse and there is | |
|
1383 | # nothing we can really do. | |
|
1408 | 1384 | ladd(fn) |
|
1409 | 1385 | elif listclean: |
|
1410 | 1386 | cadd(fn) |
@@ -12,7 +12,6 b'' | |||
|
12 | 12 | use crate::dirstate_tree::on_disk::DirstateV2ParseError; |
|
13 | 13 | |
|
14 | 14 | use crate::{ |
|
15 | dirstate::TruncatedTimestamp, | |
|
16 | 15 | utils::hg_path::{HgPath, HgPathError}, |
|
17 | 16 | PatternError, |
|
18 | 17 | }; |
@@ -62,10 +61,6 b" pub type HgPathCow<'a> = Cow<'a, HgPath>" | |||
|
62 | 61 | |
|
63 | 62 | #[derive(Debug, Copy, Clone)] |
|
64 | 63 | pub struct StatusOptions { |
|
65 | /// Remember the most recent modification timeslot for status, to make | |
|
66 | /// sure we won't miss future size-preserving file content modifications | |
|
67 | /// that happen within the same timeslot. | |
|
68 | pub last_normal_time: TruncatedTimestamp, | |
|
69 | 64 | /// Whether we are on a filesystem with UNIX-like exec flags |
|
70 | 65 | pub check_exec: bool, |
|
71 | 66 | pub list_clean: bool, |
@@ -532,8 +532,12 b" impl<'a, 'tree, 'on_disk> StatusCommon<'" | |||
|
532 | 532 | if let Some(dirstate_mtime) = entry.truncated_mtime() { |
|
533 | 533 | let fs_mtime = TruncatedTimestamp::for_mtime_of(fs_metadata) |
|
534 | 534 | .expect("OS/libc does not support mtime?"); |
|
535 | // There might be a change in the future if for example the | |
|
536 | // internal clock become off while process run, but this is a | |
|
537 | // case where the issues the user would face | |
|
538 | // would be a lot worse and there is nothing we | |
|
539 | // can really do. | |
|
535 | 540 | mtime_looks_clean = fs_mtime.likely_equal(dirstate_mtime) |
|
536 | && !fs_mtime.likely_equal(self.options.last_normal_time) | |
|
537 | 541 | } else { |
|
538 | 542 | // No mtime in the dirstate entry |
|
539 | 543 | mtime_looks_clean = false |
@@ -54,7 +54,6 b' pub fn init_module(py: Python, package: ' | |||
|
54 | 54 | matcher: PyObject, |
|
55 | 55 | ignorefiles: PyList, |
|
56 | 56 | check_exec: bool, |
|
57 | last_normal_time: (u32, u32), | |
|
58 | 57 | list_clean: bool, |
|
59 | 58 | list_ignored: bool, |
|
60 | 59 | list_unknown: bool, |
@@ -9,7 +9,6 b'' | |||
|
9 | 9 | //! `hg-core` crate. From Python, this will be seen as |
|
10 | 10 | //! `rustext.dirstate.status`. |
|
11 | 11 | |
|
12 | use crate::dirstate::item::timestamp; | |
|
13 | 12 | use crate::{dirstate::DirstateMap, exceptions::FallbackError}; |
|
14 | 13 | use cpython::exc::OSError; |
|
15 | 14 | use cpython::{ |
@@ -103,13 +102,11 b' pub fn status_wrapper(' | |||
|
103 | 102 | root_dir: PyObject, |
|
104 | 103 | ignore_files: PyList, |
|
105 | 104 | check_exec: bool, |
|
106 | last_normal_time: (u32, u32), | |
|
107 | 105 | list_clean: bool, |
|
108 | 106 | list_ignored: bool, |
|
109 | 107 | list_unknown: bool, |
|
110 | 108 | collect_traversed_dirs: bool, |
|
111 | 109 | ) -> PyResult<PyTuple> { |
|
112 | let last_normal_time = timestamp(py, last_normal_time)?; | |
|
113 | 110 | let bytes = root_dir.extract::<PyBytes>(py)?; |
|
114 | 111 | let root_dir = get_path_from_bytes(bytes.data(py)); |
|
115 | 112 | |
@@ -135,7 +132,6 b' pub fn status_wrapper(' | |||
|
135 | 132 | ignore_files, |
|
136 | 133 | StatusOptions { |
|
137 | 134 | check_exec, |
|
138 | last_normal_time, | |
|
139 | 135 | list_clean, |
|
140 | 136 | list_ignored, |
|
141 | 137 | list_unknown, |
@@ -172,7 +168,6 b' pub fn status_wrapper(' | |||
|
172 | 168 | ignore_files, |
|
173 | 169 | StatusOptions { |
|
174 | 170 | check_exec, |
|
175 | last_normal_time, | |
|
176 | 171 | list_clean, |
|
177 | 172 | list_ignored, |
|
178 | 173 | list_unknown, |
@@ -224,7 +219,6 b' pub fn status_wrapper(' | |||
|
224 | 219 | ignore_files, |
|
225 | 220 | StatusOptions { |
|
226 | 221 | check_exec, |
|
227 | last_normal_time, | |
|
228 | 222 | list_clean, |
|
229 | 223 | list_ignored, |
|
230 | 224 | list_unknown, |
@@ -12,7 +12,7 b' use clap::{Arg, SubCommand};' | |||
|
12 | 12 | use format_bytes::format_bytes; |
|
13 | 13 | use hg; |
|
14 | 14 | use hg::config::Config; |
|
15 |
use hg::dirstate:: |
|
|
15 | use hg::dirstate::has_exec_bit; | |
|
16 | 16 | use hg::errors::HgError; |
|
17 | 17 | use hg::manifest::Manifest; |
|
18 | 18 | use hg::matchers::AlwaysMatcher; |
@@ -194,11 +194,6 b' pub fn run(invocation: &crate::CliInvoca' | |||
|
194 | 194 | let mut dmap = repo.dirstate_map_mut()?; |
|
195 | 195 | |
|
196 | 196 | let options = StatusOptions { |
|
197 | // TODO should be provided by the dirstate parsing and | |
|
198 | // hence be stored on dmap. Using a value that assumes we aren't | |
|
199 | // below the time resolution granularity of the FS and the | |
|
200 | // dirstate. | |
|
201 | last_normal_time: TruncatedTimestamp::new_truncate(0, 0), | |
|
202 | 197 | // we're currently supporting file systems with exec flags only |
|
203 | 198 | // anyway |
|
204 | 199 | check_exec: true, |
@@ -369,7 +364,8 b' fn unsure_is_modified(' | |||
|
369 | 364 | let fs_path = hg_path_to_os_string(hg_path).expect("HgPath conversion"); |
|
370 | 365 | let fs_metadata = vfs.symlink_metadata(&fs_path)?; |
|
371 | 366 | let is_symlink = fs_metadata.file_type().is_symlink(); |
|
372 |
// TODO: Also account for `FALLBACK_SYMLINK` and `FALLBACK_EXEC` from the |
|
|
367 | // TODO: Also account for `FALLBACK_SYMLINK` and `FALLBACK_EXEC` from the | |
|
368 | // dirstate | |
|
373 | 369 | let fs_flags = if is_symlink { |
|
374 | 370 | Some(b'l') |
|
375 | 371 | } else if has_exec_bit(&fs_metadata) { |
General Comments 0
You need to be logged in to leave comments.
Login now