equal
deleted
inserted
replaced
13 use crate::dirstate::CopyMapIter; |
13 use crate::dirstate::CopyMapIter; |
14 use crate::dirstate::DirstateV2Data; |
14 use crate::dirstate::DirstateV2Data; |
15 use crate::dirstate::ParentFileData; |
15 use crate::dirstate::ParentFileData; |
16 use crate::dirstate::StateMapIter; |
16 use crate::dirstate::StateMapIter; |
17 use crate::dirstate::TruncatedTimestamp; |
17 use crate::dirstate::TruncatedTimestamp; |
18 use crate::dirstate::SIZE_FROM_OTHER_PARENT; |
|
19 use crate::dirstate::SIZE_NON_NORMAL; |
|
20 use crate::matchers::Matcher; |
18 use crate::matchers::Matcher; |
21 use crate::utils::hg_path::{HgPath, HgPathBuf}; |
19 use crate::utils::hg_path::{HgPath, HgPathBuf}; |
22 use crate::DirstateEntry; |
20 use crate::DirstateEntry; |
23 use crate::DirstateError; |
21 use crate::DirstateError; |
24 use crate::DirstateMapError; |
22 use crate::DirstateMapError; |
1046 p1_tracked, |
1044 p1_tracked, |
1047 p2_info, |
1045 p2_info, |
1048 has_meaningful_mtime, |
1046 has_meaningful_mtime, |
1049 parent_file_data_opt, |
1047 parent_file_data_opt, |
1050 ) |
1048 ) |
1051 }) |
|
1052 } |
|
1053 |
|
1054 pub fn remove_file( |
|
1055 &mut self, |
|
1056 filename: &HgPath, |
|
1057 in_merge: bool, |
|
1058 ) -> Result<(), DirstateError> { |
|
1059 let old_entry_opt = self.get(filename)?; |
|
1060 let old_state = old_entry_opt.map(|e| e.state()); |
|
1061 let mut size = 0; |
|
1062 if in_merge { |
|
1063 // XXX we should not be able to have 'm' state and 'FROM_P2' if not |
|
1064 // during a merge. So I (marmoute) am not sure we need the |
|
1065 // conditionnal at all. Adding double checking this with assert |
|
1066 // would be nice. |
|
1067 if let Some(old_entry) = old_entry_opt { |
|
1068 // backup the previous state |
|
1069 if old_entry.state() == EntryState::Merged { |
|
1070 size = SIZE_NON_NORMAL; |
|
1071 } else if old_entry.state() == EntryState::Normal |
|
1072 && old_entry.size() == SIZE_FROM_OTHER_PARENT |
|
1073 { |
|
1074 // other parent |
|
1075 size = SIZE_FROM_OTHER_PARENT; |
|
1076 } |
|
1077 } |
|
1078 } |
|
1079 if size == 0 { |
|
1080 self.copy_map_remove(filename)?; |
|
1081 } |
|
1082 self.with_dmap_mut(|map| { |
|
1083 let entry = DirstateEntry::new_removed(size); |
|
1084 Ok(map.add_or_remove_file(filename, old_state, entry)?) |
|
1085 }) |
1049 }) |
1086 } |
1050 } |
1087 |
1051 |
1088 pub fn drop_entry_and_copy_source( |
1052 pub fn drop_entry_and_copy_source( |
1089 &mut self, |
1053 &mut self, |