Mercurial > hg
comparison rust/hg-core/src/dirstate/dirstate_map.rs @ 46890:441024b279a6
rust: Remove the compile-time 'dirstate-tree' feature flag
This code has compiler errors since it is not built on CI and nobody has been
working on it for some time.
We (Octobus) are still pursuing status optimizations based on a tree data
structure for the dirstate, but upcoming patches will use a run-time opt-in
instead of compile-time, so that at least corresponding Rust code keeps
compiling when other changes are made.
Differential Revision: https://phab.mercurial-scm.org/D10329
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Thu, 08 Apr 2021 21:46:54 +0200 |
parents | 98a455a62699 |
children | 787ff5d21bcd |
comparison
equal
deleted
inserted
replaced
46889:8759e22f1649 | 46890:441024b279a6 |
---|---|
252 self.non_normal_set.as_ref().unwrap(), | 252 self.non_normal_set.as_ref().unwrap(), |
253 self.other_parent_set.as_ref().unwrap(), | 253 self.other_parent_set.as_ref().unwrap(), |
254 ) | 254 ) |
255 } | 255 } |
256 | 256 |
257 #[cfg(not(feature = "dirstate-tree"))] | |
258 pub fn set_non_normal_other_parent_entries(&mut self, force: bool) { | 257 pub fn set_non_normal_other_parent_entries(&mut self, force: bool) { |
259 if !force | 258 if !force |
260 && self.non_normal_set.is_some() | 259 && self.non_normal_set.is_some() |
261 && self.other_parent_set.is_some() | 260 && self.other_parent_set.is_some() |
262 { | 261 { |
275 if *state != EntryState::Normal || *mtime == MTIME_UNSET { | 274 if *state != EntryState::Normal || *mtime == MTIME_UNSET { |
276 non_normal.insert(filename.to_owned()); | 275 non_normal.insert(filename.to_owned()); |
277 } | 276 } |
278 if *state == EntryState::Normal && *size == SIZE_FROM_OTHER_PARENT | 277 if *state == EntryState::Normal && *size == SIZE_FROM_OTHER_PARENT |
279 { | 278 { |
280 other_parent.insert(filename.to_owned()); | |
281 } | |
282 } | |
283 self.non_normal_set = Some(non_normal); | |
284 self.other_parent_set = Some(other_parent); | |
285 } | |
286 #[cfg(feature = "dirstate-tree")] | |
287 pub fn set_non_normal_other_parent_entries(&mut self, force: bool) { | |
288 if !force | |
289 && self.non_normal_set.is_some() | |
290 && self.other_parent_set.is_some() | |
291 { | |
292 return; | |
293 } | |
294 let mut non_normal = HashSet::new(); | |
295 let mut other_parent = HashSet::new(); | |
296 | |
297 for ( | |
298 filename, | |
299 DirstateEntry { | |
300 state, size, mtime, .. | |
301 }, | |
302 ) in self.state_map.iter() | |
303 { | |
304 if state != EntryState::Normal || mtime == MTIME_UNSET { | |
305 non_normal.insert(filename.to_owned()); | |
306 } | |
307 if state == EntryState::Normal && size == SIZE_FROM_OTHER_PARENT { | |
308 other_parent.insert(filename.to_owned()); | 279 other_parent.insert(filename.to_owned()); |
309 } | 280 } |
310 } | 281 } |
311 self.non_normal_set = Some(non_normal); | 282 self.non_normal_set = Some(non_normal); |
312 self.other_parent_set = Some(other_parent); | 283 self.other_parent_set = Some(other_parent); |
424 self.dirty_parents = false; | 395 self.dirty_parents = false; |
425 | 396 |
426 self.set_non_normal_other_parent_entries(true); | 397 self.set_non_normal_other_parent_entries(true); |
427 Ok(packed) | 398 Ok(packed) |
428 } | 399 } |
429 #[cfg(not(feature = "dirstate-tree"))] | |
430 pub fn build_file_fold_map(&mut self) -> &FileFoldMap { | 400 pub fn build_file_fold_map(&mut self) -> &FileFoldMap { |
431 if let Some(ref file_fold_map) = self.file_fold_map { | 401 if let Some(ref file_fold_map) = self.file_fold_map { |
432 return file_fold_map; | 402 return file_fold_map; |
433 } | 403 } |
434 let mut new_file_fold_map = FileFoldMap::default(); | 404 let mut new_file_fold_map = FileFoldMap::default(); |
435 | 405 |
436 for (filename, DirstateEntry { state, .. }) in self.state_map.iter() { | 406 for (filename, DirstateEntry { state, .. }) in self.state_map.iter() { |
437 if *state != EntryState::Removed { | 407 if *state != EntryState::Removed { |
438 new_file_fold_map | |
439 .insert(normalize_case(&filename), filename.to_owned()); | |
440 } | |
441 } | |
442 self.file_fold_map = Some(new_file_fold_map); | |
443 self.file_fold_map.as_ref().unwrap() | |
444 } | |
445 #[cfg(feature = "dirstate-tree")] | |
446 pub fn build_file_fold_map(&mut self) -> &FileFoldMap { | |
447 if let Some(ref file_fold_map) = self.file_fold_map { | |
448 return file_fold_map; | |
449 } | |
450 let mut new_file_fold_map = FileFoldMap::default(); | |
451 | |
452 for (filename, DirstateEntry { state, .. }) in self.state_map.iter() { | |
453 if state != EntryState::Removed { | |
454 new_file_fold_map | 408 new_file_fold_map |
455 .insert(normalize_case(&filename), filename.to_owned()); | 409 .insert(normalize_case(&filename), filename.to_owned()); |
456 } | 410 } |
457 } | 411 } |
458 self.file_fold_map = Some(new_file_fold_map); | 412 self.file_fold_map = Some(new_file_fold_map); |