1 use crate::dirstate::owning::OwningDirstateMap; |
1 use crate::dirstate::owning::OwningDirstateMap; |
2 use hg::dirstate::parsers::Timestamp; |
2 use hg::dirstate::parsers::Timestamp; |
3 use hg::dirstate_tree::dispatch::DirstateMapMethods; |
3 use hg::dirstate_tree::dispatch::DirstateMapMethods; |
|
4 use hg::dirstate_tree::on_disk::DirstateV2ParseError; |
4 use hg::matchers::Matcher; |
5 use hg::matchers::Matcher; |
5 use hg::utils::hg_path::{HgPath, HgPathBuf}; |
6 use hg::utils::hg_path::{HgPath, HgPathBuf}; |
6 use hg::CopyMapIter; |
7 use hg::CopyMapIter; |
7 use hg::DirstateEntry; |
8 use hg::DirstateEntry; |
8 use hg::DirstateError; |
9 use hg::DirstateError; |
9 use hg::DirstateMapError; |
|
10 use hg::DirstateParents; |
10 use hg::DirstateParents; |
11 use hg::DirstateStatus; |
11 use hg::DirstateStatus; |
12 use hg::EntryState; |
12 use hg::EntryState; |
13 use hg::PatternFileWarning; |
13 use hg::PatternFileWarning; |
14 use hg::StateMapIter; |
14 use hg::StateMapIter; |
24 fn add_file( |
24 fn add_file( |
25 &mut self, |
25 &mut self, |
26 filename: &HgPath, |
26 filename: &HgPath, |
27 old_state: EntryState, |
27 old_state: EntryState, |
28 entry: DirstateEntry, |
28 entry: DirstateEntry, |
29 ) -> Result<(), DirstateMapError> { |
29 ) -> Result<(), DirstateError> { |
30 self.get_mut().add_file(filename, old_state, entry) |
30 self.get_mut().add_file(filename, old_state, entry) |
31 } |
31 } |
32 |
32 |
33 fn remove_file( |
33 fn remove_file( |
34 &mut self, |
34 &mut self, |
35 filename: &HgPath, |
35 filename: &HgPath, |
36 old_state: EntryState, |
36 old_state: EntryState, |
37 size: i32, |
37 size: i32, |
38 ) -> Result<(), DirstateMapError> { |
38 ) -> Result<(), DirstateError> { |
39 self.get_mut().remove_file(filename, old_state, size) |
39 self.get_mut().remove_file(filename, old_state, size) |
40 } |
40 } |
41 |
41 |
42 fn drop_file( |
42 fn drop_file( |
43 &mut self, |
43 &mut self, |
44 filename: &HgPath, |
44 filename: &HgPath, |
45 old_state: EntryState, |
45 old_state: EntryState, |
46 ) -> Result<bool, DirstateMapError> { |
46 ) -> Result<bool, DirstateError> { |
47 self.get_mut().drop_file(filename, old_state) |
47 self.get_mut().drop_file(filename, old_state) |
48 } |
48 } |
49 |
49 |
50 fn clear_ambiguous_times(&mut self, filenames: Vec<HgPathBuf>, now: i32) { |
50 fn clear_ambiguous_times( |
|
51 &mut self, |
|
52 filenames: Vec<HgPathBuf>, |
|
53 now: i32, |
|
54 ) -> Result<(), DirstateV2ParseError> { |
51 self.get_mut().clear_ambiguous_times(filenames, now) |
55 self.get_mut().clear_ambiguous_times(filenames, now) |
52 } |
56 } |
53 |
57 |
54 fn non_normal_entries_contains(&mut self, key: &HgPath) -> bool { |
58 fn non_normal_entries_contains( |
|
59 &mut self, |
|
60 key: &HgPath, |
|
61 ) -> Result<bool, DirstateV2ParseError> { |
55 self.get_mut().non_normal_entries_contains(key) |
62 self.get_mut().non_normal_entries_contains(key) |
56 } |
63 } |
57 |
64 |
58 fn non_normal_entries_remove(&mut self, key: &HgPath) { |
65 fn non_normal_entries_remove(&mut self, key: &HgPath) { |
59 self.get_mut().non_normal_entries_remove(key) |
66 self.get_mut().non_normal_entries_remove(key) |
60 } |
67 } |
61 |
68 |
62 fn non_normal_or_other_parent_paths( |
69 fn non_normal_or_other_parent_paths( |
63 &mut self, |
70 &mut self, |
64 ) -> Box<dyn Iterator<Item = &HgPath> + '_> { |
71 ) -> Box<dyn Iterator<Item = Result<&HgPath, DirstateV2ParseError>> + '_> |
|
72 { |
65 self.get_mut().non_normal_or_other_parent_paths() |
73 self.get_mut().non_normal_or_other_parent_paths() |
66 } |
74 } |
67 |
75 |
68 fn set_non_normal_other_parent_entries(&mut self, force: bool) { |
76 fn set_non_normal_other_parent_entries(&mut self, force: bool) { |
69 self.get_mut().set_non_normal_other_parent_entries(force) |
77 self.get_mut().set_non_normal_other_parent_entries(force) |
70 } |
78 } |
71 |
79 |
72 fn iter_non_normal_paths( |
80 fn iter_non_normal_paths( |
73 &mut self, |
81 &mut self, |
74 ) -> Box<dyn Iterator<Item = &HgPath> + Send + '_> { |
82 ) -> Box< |
|
83 dyn Iterator<Item = Result<&HgPath, DirstateV2ParseError>> + Send + '_, |
|
84 > { |
75 self.get_mut().iter_non_normal_paths() |
85 self.get_mut().iter_non_normal_paths() |
76 } |
86 } |
77 |
87 |
78 fn iter_non_normal_paths_panic( |
88 fn iter_non_normal_paths_panic( |
79 &self, |
89 &self, |
80 ) -> Box<dyn Iterator<Item = &HgPath> + Send + '_> { |
90 ) -> Box< |
|
91 dyn Iterator<Item = Result<&HgPath, DirstateV2ParseError>> + Send + '_, |
|
92 > { |
81 self.get().iter_non_normal_paths_panic() |
93 self.get().iter_non_normal_paths_panic() |
82 } |
94 } |
83 |
95 |
84 fn iter_other_parent_paths( |
96 fn iter_other_parent_paths( |
85 &mut self, |
97 &mut self, |
86 ) -> Box<dyn Iterator<Item = &HgPath> + Send + '_> { |
98 ) -> Box< |
|
99 dyn Iterator<Item = Result<&HgPath, DirstateV2ParseError>> + Send + '_, |
|
100 > { |
87 self.get_mut().iter_other_parent_paths() |
101 self.get_mut().iter_other_parent_paths() |
88 } |
102 } |
89 |
103 |
90 fn has_tracked_dir( |
104 fn has_tracked_dir( |
91 &mut self, |
105 &mut self, |
92 directory: &HgPath, |
106 directory: &HgPath, |
93 ) -> Result<bool, DirstateMapError> { |
107 ) -> Result<bool, DirstateError> { |
94 self.get_mut().has_tracked_dir(directory) |
108 self.get_mut().has_tracked_dir(directory) |
95 } |
109 } |
96 |
110 |
97 fn has_dir( |
111 fn has_dir(&mut self, directory: &HgPath) -> Result<bool, DirstateError> { |
98 &mut self, |
|
99 directory: &HgPath, |
|
100 ) -> Result<bool, DirstateMapError> { |
|
101 self.get_mut().has_dir(directory) |
112 self.get_mut().has_dir(directory) |
102 } |
113 } |
103 |
114 |
104 fn pack_v1( |
115 fn pack_v1( |
105 &mut self, |
116 &mut self, |
143 |
154 |
144 fn copy_map_iter(&self) -> CopyMapIter<'_> { |
155 fn copy_map_iter(&self) -> CopyMapIter<'_> { |
145 self.get().copy_map_iter() |
156 self.get().copy_map_iter() |
146 } |
157 } |
147 |
158 |
148 fn copy_map_contains_key(&self, key: &HgPath) -> bool { |
159 fn copy_map_contains_key( |
|
160 &self, |
|
161 key: &HgPath, |
|
162 ) -> Result<bool, DirstateV2ParseError> { |
149 self.get().copy_map_contains_key(key) |
163 self.get().copy_map_contains_key(key) |
150 } |
164 } |
151 |
165 |
152 fn copy_map_get(&self, key: &HgPath) -> Option<&HgPath> { |
166 fn copy_map_get( |
|
167 &self, |
|
168 key: &HgPath, |
|
169 ) -> Result<Option<&HgPath>, DirstateV2ParseError> { |
153 self.get().copy_map_get(key) |
170 self.get().copy_map_get(key) |
154 } |
171 } |
155 |
172 |
156 fn copy_map_remove(&mut self, key: &HgPath) -> Option<HgPathBuf> { |
173 fn copy_map_remove( |
|
174 &mut self, |
|
175 key: &HgPath, |
|
176 ) -> Result<Option<HgPathBuf>, DirstateV2ParseError> { |
157 self.get_mut().copy_map_remove(key) |
177 self.get_mut().copy_map_remove(key) |
158 } |
178 } |
159 |
179 |
160 fn copy_map_insert( |
180 fn copy_map_insert( |
161 &mut self, |
181 &mut self, |
162 key: HgPathBuf, |
182 key: HgPathBuf, |
163 value: HgPathBuf, |
183 value: HgPathBuf, |
164 ) -> Option<HgPathBuf> { |
184 ) -> Result<Option<HgPathBuf>, DirstateV2ParseError> { |
165 self.get_mut().copy_map_insert(key, value) |
185 self.get_mut().copy_map_insert(key, value) |
166 } |
186 } |
167 |
187 |
168 fn len(&self) -> usize { |
188 fn len(&self) -> usize { |
169 self.get().len() |
189 self.get().len() |
170 } |
190 } |
171 |
191 |
172 fn contains_key(&self, key: &HgPath) -> bool { |
192 fn contains_key( |
|
193 &self, |
|
194 key: &HgPath, |
|
195 ) -> Result<bool, DirstateV2ParseError> { |
173 self.get().contains_key(key) |
196 self.get().contains_key(key) |
174 } |
197 } |
175 |
198 |
176 fn get(&self, key: &HgPath) -> Option<DirstateEntry> { |
199 fn get( |
|
200 &self, |
|
201 key: &HgPath, |
|
202 ) -> Result<Option<DirstateEntry>, DirstateV2ParseError> { |
177 self.get().get(key) |
203 self.get().get(key) |
178 } |
204 } |
179 |
205 |
180 fn iter(&self) -> StateMapIter<'_> { |
206 fn iter(&self) -> StateMapIter<'_> { |
181 self.get().iter() |
207 self.get().iter() |