##// END OF EJS Templates
rust-dirstatemap: directly return `non_normal` and `other_entries`...
Raphaël Gomès -
r44842:c089a094 default
parent child Browse files
Show More
@@ -100,16 +100,12 b' impl DirstateMap {'
100 100 if entry.state != EntryState::Normal || entry.mtime == MTIME_UNSET {
101 101 self.get_non_normal_other_parent_entries()
102 102 .0
103 .as_mut()
104 .unwrap()
105 103 .insert(filename.to_owned());
106 104 }
107 105
108 106 if entry.size == SIZE_FROM_OTHER_PARENT {
109 107 self.get_non_normal_other_parent_entries()
110 108 .1
111 .as_mut()
112 .unwrap()
113 109 .insert(filename.to_owned());
114 110 }
115 111 Ok(())
@@ -152,8 +148,6 b' impl DirstateMap {'
152 148 );
153 149 self.get_non_normal_other_parent_entries()
154 150 .0
155 .as_mut()
156 .unwrap()
157 151 .insert(filename.to_owned());
158 152 Ok(())
159 153 }
@@ -182,8 +176,6 b' impl DirstateMap {'
182 176 }
183 177 self.get_non_normal_other_parent_entries()
184 178 .0
185 .as_mut()
186 .unwrap()
187 179 .remove(filename);
188 180
189 181 Ok(exists)
@@ -211,8 +203,6 b' impl DirstateMap {'
211 203 if changed {
212 204 self.get_non_normal_other_parent_entries()
213 205 .0
214 .as_mut()
215 .unwrap()
216 206 .insert(filename.to_owned());
217 207 }
218 208 }
@@ -224,8 +214,6 b' impl DirstateMap {'
224 214 ) -> bool {
225 215 self.get_non_normal_other_parent_entries()
226 216 .0
227 .as_mut()
228 .unwrap()
229 217 .remove(key.as_ref())
230 218 }
231 219 pub fn non_normal_entries_union(
@@ -234,8 +222,6 b' impl DirstateMap {'
234 222 ) -> Vec<HgPathBuf> {
235 223 self.get_non_normal_other_parent_entries()
236 224 .0
237 .as_mut()
238 .unwrap()
239 225 .union(&other)
240 226 .map(|e| e.to_owned())
241 227 .collect()
@@ -243,12 +229,12 b' impl DirstateMap {'
243 229
244 230 pub fn get_non_normal_other_parent_entries(
245 231 &mut self,
246 ) -> (
247 &mut Option<HashSet<HgPathBuf>>,
248 &mut Option<HashSet<HgPathBuf>>,
249 ) {
232 ) -> (&mut HashSet<HgPathBuf>, &mut HashSet<HgPathBuf>) {
250 233 self.set_non_normal_other_parent_entries(false);
251 (&mut self.non_normal_set, &mut self.other_parent_set)
234 (
235 self.non_normal_set.as_mut().unwrap(),
236 self.other_parent_set.as_mut().unwrap(),
237 )
252 238 }
253 239
254 240 pub fn set_non_normal_other_parent_entries(&mut self, force: bool) {
@@ -440,22 +426,8 b' mod tests {'
440 426 .unwrap();
441 427
442 428 assert_eq!(1, map.len());
443 assert_eq!(
444 0,
445 map.get_non_normal_other_parent_entries()
446 .0
447 .as_ref()
448 .unwrap()
449 .len()
450 );
451 assert_eq!(
452 0,
453 map.get_non_normal_other_parent_entries()
454 .1
455 .as_ref()
456 .unwrap()
457 .len()
458 );
429 assert_eq!(0, map.get_non_normal_other_parent_entries().0.len());
430 assert_eq!(0, map.get_non_normal_other_parent_entries().1.len());
459 431 }
460 432
461 433 #[test]
@@ -487,7 +459,7 b' mod tests {'
487 459 })
488 460 .collect();
489 461
490 let non_normal = [
462 let mut non_normal = [
491 463 b"f1", b"f2", b"f5", b"f6", b"f7", b"f8", b"f9", b"fa", b"fb",
492 464 ]
493 465 .iter()
@@ -499,8 +471,8 b' mod tests {'
499 471 let entries = map.get_non_normal_other_parent_entries();
500 472
501 473 assert_eq!(
502 (Some(non_normal), Some(other_parent)),
503 (entries.0.to_owned(), entries.1.to_owned())
474 (&mut non_normal, &mut other_parent),
475 (entries.0, entries.1)
504 476 );
505 477 }
506 478 }
@@ -175,8 +175,7 b' py_class!(pub class DirstateMap |py| {'
175 175 locals.set_item(
176 176 py,
177 177 "other_parent",
178 other_parent.as_ref()
179 .unwrap()
178 other_parent
180 179 .iter()
181 180 .map(|v| PyBytes::new(py, v.as_ref()))
182 181 .collect::<Vec<PyBytes>>()
@@ -196,8 +195,6 b' py_class!(pub class DirstateMap |py| {'
196 195 .inner(py)
197 196 .borrow_mut()
198 197 .get_non_normal_other_parent_entries().0
199 .as_ref()
200 .unwrap()
201 198 .contains(HgPath::new(key.data(py))))
202 199 }
203 200
@@ -211,8 +208,7 b' py_class!(pub class DirstateMap |py| {'
211 208 .inner(py)
212 209 .borrow_mut()
213 210 .get_non_normal_other_parent_entries().0
214 .as_ref()
215 .unwrap().iter().map(|o| o))
211 .iter().map(|o| o))
216 212 )
217 213 )
218 214 }
General Comments 0
You need to be logged in to leave comments. Login now