5 // This software may be used and distributed according to the terms of the |
5 // This software may be used and distributed according to the terms of the |
6 // GNU General Public License version 2 or any later version. |
6 // GNU General Public License version 2 or any later version. |
7 |
7 |
8 use crate::{ |
8 use crate::{ |
9 dirstate::{parsers::PARENT_SIZE, EntryState}, |
9 dirstate::{parsers::PARENT_SIZE, EntryState}, |
10 pack_dirstate, parse_dirstate, CopyMap, DirsMultiset, DirstateEntry, |
10 pack_dirstate, parse_dirstate, |
11 DirstateError, DirstateMapError, DirstateParents, DirstateParseError, |
11 utils::files::normalize_case, |
12 StateMap, |
12 CopyMap, DirsMultiset, DirstateEntry, DirstateError, DirstateMapError, |
|
13 DirstateParents, DirstateParseError, StateMap, |
13 }; |
14 }; |
14 use core::borrow::Borrow; |
15 use core::borrow::Borrow; |
15 use std::collections::{HashMap, HashSet}; |
16 use std::collections::{HashMap, HashSet}; |
16 use std::convert::TryInto; |
17 use std::convert::TryInto; |
17 use std::iter::FromIterator; |
18 use std::iter::FromIterator; |
125 all_dirs.add_path(filename); |
126 all_dirs.add_path(filename); |
126 } |
127 } |
127 } |
128 } |
128 |
129 |
129 if let Some(ref mut file_fold_map) = self.file_fold_map { |
130 if let Some(ref mut file_fold_map) = self.file_fold_map { |
130 file_fold_map.remove(&filename.to_ascii_uppercase()); |
131 file_fold_map.remove(&normalize_case(filename)); |
131 } |
132 } |
132 self.state_map.insert( |
133 self.state_map.insert( |
133 filename.to_owned(), |
134 filename.to_owned(), |
134 DirstateEntry { |
135 DirstateEntry { |
135 state: EntryState::Removed, |
136 state: EntryState::Removed, |
160 if let Some(ref mut all_dirs) = self.all_dirs { |
161 if let Some(ref mut all_dirs) = self.all_dirs { |
161 all_dirs.delete_path(filename)?; |
162 all_dirs.delete_path(filename)?; |
162 } |
163 } |
163 } |
164 } |
164 if let Some(ref mut file_fold_map) = self.file_fold_map { |
165 if let Some(ref mut file_fold_map) = self.file_fold_map { |
165 file_fold_map.remove(&filename.to_ascii_uppercase()); |
166 file_fold_map.remove(&normalize_case(filename)); |
166 } |
167 } |
167 self.non_normal_set.remove(filename); |
168 self.non_normal_set.remove(filename); |
168 |
169 |
169 Ok(exists) |
170 Ok(exists) |
170 } |
171 } |
324 } |
325 } |
325 let mut new_file_fold_map = FileFoldMap::new(); |
326 let mut new_file_fold_map = FileFoldMap::new(); |
326 for (filename, DirstateEntry { state, .. }) in self.state_map.borrow() |
327 for (filename, DirstateEntry { state, .. }) in self.state_map.borrow() |
327 { |
328 { |
328 if *state == EntryState::Removed { |
329 if *state == EntryState::Removed { |
329 new_file_fold_map.insert( |
330 new_file_fold_map |
330 filename.to_ascii_uppercase().to_owned(), |
331 .insert(normalize_case(filename), filename.to_owned()); |
331 filename.to_owned(), |
|
332 ); |
|
333 } |
332 } |
334 } |
333 } |
335 self.file_fold_map = Some(new_file_fold_map); |
334 self.file_fold_map = Some(new_file_fold_map); |
336 self.file_fold_map.as_ref().unwrap() |
335 self.file_fold_map.as_ref().unwrap() |
337 } |
336 } |