Show More
@@ -330,13 +330,6 b' class dirstatemap(object):' | |||
|
330 | 330 | entry.set_untracked() |
|
331 | 331 | return True |
|
332 | 332 | |
|
333 | def clearambiguoustimes(self, files, now): | |
|
334 | for f in files: | |
|
335 | e = self.get(f) | |
|
336 | if e is not None and e.need_delay(now): | |
|
337 | e.set_possibly_dirty() | |
|
338 | self.nonnormalset.add(f) | |
|
339 | ||
|
340 | 333 | def nonnormalentries(self): |
|
341 | 334 | '''Compute the nonnormal dirstate entries from the dmap''' |
|
342 | 335 | try: |
@@ -701,9 +694,6 b' if rustmod is not None:' | |||
|
701 | 694 | def removefile(self, *args, **kwargs): |
|
702 | 695 | return self._rustmap.removefile(*args, **kwargs) |
|
703 | 696 | |
|
704 | def clearambiguoustimes(self, *args, **kwargs): | |
|
705 | return self._rustmap.clearambiguoustimes(*args, **kwargs) | |
|
706 | ||
|
707 | 697 | def nonnormalentries(self): |
|
708 | 698 | return self._rustmap.nonnormalentries() |
|
709 | 699 |
@@ -182,22 +182,6 b' impl DirstateMap {' | |||
|
182 | 182 | Ok(()) |
|
183 | 183 | } |
|
184 | 184 | |
|
185 | pub fn clear_ambiguous_times( | |
|
186 | &mut self, | |
|
187 | filenames: Vec<HgPathBuf>, | |
|
188 | now: i32, | |
|
189 | ) { | |
|
190 | for filename in filenames { | |
|
191 | if let Some(entry) = self.state_map.get_mut(&filename) { | |
|
192 | if entry.clear_ambiguous_mtime(now) { | |
|
193 | self.get_non_normal_other_parent_entries() | |
|
194 | .0 | |
|
195 | .insert(filename.to_owned()); | |
|
196 | } | |
|
197 | } | |
|
198 | } | |
|
199 | } | |
|
200 | ||
|
201 | 185 | pub fn non_normal_entries_remove( |
|
202 | 186 | &mut self, |
|
203 | 187 | key: impl AsRef<HgPath>, |
@@ -917,26 +917,6 b" impl<'on_disk> super::dispatch::Dirstate" | |||
|
917 | 917 | Ok(()) |
|
918 | 918 | } |
|
919 | 919 | |
|
920 | fn clear_ambiguous_times( | |
|
921 | &mut self, | |
|
922 | filenames: Vec<HgPathBuf>, | |
|
923 | now: i32, | |
|
924 | ) -> Result<(), DirstateV2ParseError> { | |
|
925 | for filename in filenames { | |
|
926 | if let Some(node) = Self::get_node_mut( | |
|
927 | self.on_disk, | |
|
928 | &mut self.unreachable_bytes, | |
|
929 | &mut self.root, | |
|
930 | &filename, | |
|
931 | )? { | |
|
932 | if let NodeData::Entry(entry) = &mut node.data { | |
|
933 | entry.clear_ambiguous_mtime(now); | |
|
934 | } | |
|
935 | } | |
|
936 | } | |
|
937 | Ok(()) | |
|
938 | } | |
|
939 | ||
|
940 | 920 | fn non_normal_entries_contains( |
|
941 | 921 | &mut self, |
|
942 | 922 | key: &HgPath, |
@@ -67,15 +67,6 b' pub trait DirstateMapMethods {' | |||
|
67 | 67 | filename: &HgPath, |
|
68 | 68 | ) -> Result<(), DirstateError>; |
|
69 | 69 | |
|
70 | /// Among given files, mark the stored `mtime` as ambiguous if there is one | |
|
71 | /// (if `state == EntryState::Normal`) equal to the given current Unix | |
|
72 | /// timestamp. | |
|
73 | fn clear_ambiguous_times( | |
|
74 | &mut self, | |
|
75 | filenames: Vec<HgPathBuf>, | |
|
76 | now: i32, | |
|
77 | ) -> Result<(), DirstateV2ParseError>; | |
|
78 | ||
|
79 | 70 | /// Return whether the map has an "non-normal" entry for the given |
|
80 | 71 | /// filename. That is, any entry with a `state` other than |
|
81 | 72 | /// `EntryState::Normal` or with an ambiguous `mtime`. |
@@ -165,20 +156,18 b' pub trait DirstateMapMethods {' | |||
|
165 | 156 | /// file with a dirstate entry. |
|
166 | 157 | fn has_dir(&mut self, directory: &HgPath) -> Result<bool, DirstateError>; |
|
167 | 158 | |
|
168 | /// Clear mtimes that are ambigous with `now` (similar to | |
|
169 | /// `clear_ambiguous_times` but for all files in the dirstate map), and | |
|
170 | /// serialize bytes to write the `.hg/dirstate` file to disk in dirstate-v1 | |
|
171 | /// format. | |
|
159 | /// Clear mtimes equal to `now` in entries with `state == | |
|
160 | /// EntryState::Normal`, and serialize bytes to write the `.hg/dirstate` | |
|
161 | /// file to disk in dirstate-v1 format. | |
|
172 | 162 | fn pack_v1( |
|
173 | 163 | &mut self, |
|
174 | 164 | parents: DirstateParents, |
|
175 | 165 | now: Timestamp, |
|
176 | 166 | ) -> Result<Vec<u8>, DirstateError>; |
|
177 | 167 | |
|
178 | /// Clear mtimes that are ambigous with `now` (similar to | |
|
179 | /// `clear_ambiguous_times` but for all files in the dirstate map), and | |
|
180 | /// serialize bytes to write a dirstate data file to disk in dirstate-v2 | |
|
181 | /// format. | |
|
168 | /// Clear mtimes equal to `now` in entries with `state == | |
|
169 | /// EntryState::Normal`, and serialize bytes to write a dirstate data file | |
|
170 | /// to disk in dirstate-v2 format. | |
|
182 | 171 | /// |
|
183 | 172 | /// Returns new data and metadata together with whether that data should be |
|
184 | 173 | /// appended to the existing data file whose content is at |
@@ -341,14 +330,6 b' impl DirstateMapMethods for DirstateMap ' | |||
|
341 | 330 | self.drop_entry_and_copy_source(filename) |
|
342 | 331 | } |
|
343 | 332 | |
|
344 | fn clear_ambiguous_times( | |
|
345 | &mut self, | |
|
346 | filenames: Vec<HgPathBuf>, | |
|
347 | now: i32, | |
|
348 | ) -> Result<(), DirstateV2ParseError> { | |
|
349 | Ok(self.clear_ambiguous_times(filenames, now)) | |
|
350 | } | |
|
351 | ||
|
352 | 333 | fn non_normal_entries_contains( |
|
353 | 334 | &mut self, |
|
354 | 335 | key: &HgPath, |
@@ -51,14 +51,6 b' impl DirstateMapMethods for OwningDirsta' | |||
|
51 | 51 | self.get_mut().drop_entry_and_copy_source(filename) |
|
52 | 52 | } |
|
53 | 53 | |
|
54 | fn clear_ambiguous_times( | |
|
55 | &mut self, | |
|
56 | filenames: Vec<HgPathBuf>, | |
|
57 | now: i32, | |
|
58 | ) -> Result<(), DirstateV2ParseError> { | |
|
59 | self.get_mut().clear_ambiguous_times(filenames, now) | |
|
60 | } | |
|
61 | ||
|
62 | 54 | fn non_normal_entries_contains( |
|
63 | 55 | &mut self, |
|
64 | 56 | key: &HgPath, |
@@ -12,9 +12,9 b' use std::cell::{RefCell, RefMut};' | |||
|
12 | 12 | use std::convert::TryInto; |
|
13 | 13 | |
|
14 | 14 | use cpython::{ |
|
15 |
exc |
|
|
16 |
|
|
|
17 |
|
|
|
15 | exc, PyBool, PyBytes, PyClone, PyDict, PyErr, PyList, PyNone, PyObject, | |
|
16 | PyResult, PySet, PyString, Python, PythonObject, ToPyObject, | |
|
17 | UnsafePyLeaked, | |
|
18 | 18 | }; |
|
19 | 19 | |
|
20 | 20 | use crate::{ |
@@ -185,26 +185,6 b' py_class!(pub class DirstateMap |py| {' | |||
|
185 | 185 | Ok(PyNone) |
|
186 | 186 | } |
|
187 | 187 | |
|
188 | def clearambiguoustimes( | |
|
189 | &self, | |
|
190 | files: PyObject, | |
|
191 | now: PyObject | |
|
192 | ) -> PyResult<PyObject> { | |
|
193 | let files: PyResult<Vec<HgPathBuf>> = files | |
|
194 | .iter(py)? | |
|
195 | .map(|filename| { | |
|
196 | Ok(HgPathBuf::from_bytes( | |
|
197 | filename?.extract::<PyBytes>(py)?.data(py), | |
|
198 | )) | |
|
199 | }) | |
|
200 | .collect(); | |
|
201 | self.inner(py) | |
|
202 | .borrow_mut() | |
|
203 | .clear_ambiguous_times(files?, now.extract(py)?) | |
|
204 | .map_err(|e| v2_error(py, e))?; | |
|
205 | Ok(py.None()) | |
|
206 | } | |
|
207 | ||
|
208 | 188 | def other_parent_entries(&self) -> PyResult<PyObject> { |
|
209 | 189 | let mut inner_shared = self.inner(py).borrow_mut(); |
|
210 | 190 | let set = PySet::empty(py)?; |
General Comments 0
You need to be logged in to leave comments.
Login now