Show More
@@ -1,7 +1,5 b'' | |||
|
1 | 1 | pub mod dirstate_map; |
|
2 | pub mod dispatch; | |
|
3 | 2 | pub mod on_disk; |
|
4 | 3 | pub mod owning; |
|
5 | mod owning_dispatch; | |
|
6 | 4 | pub mod path_with_basename; |
|
7 | 5 | pub mod status; |
@@ -6,6 +6,7 b' use std::path::PathBuf;' | |||
|
6 | 6 | |
|
7 | 7 | use super::on_disk; |
|
8 | 8 | use super::on_disk::DirstateV2ParseError; |
|
9 | use super::owning::OwningDirstateMap; | |
|
9 | 10 | use super::path_with_basename::WithBasename; |
|
10 | 11 | use crate::dirstate::parsers::pack_entry; |
|
11 | 12 | use crate::dirstate::parsers::packed_entry_size; |
@@ -728,32 +729,35 b' where' | |||
|
728 | 729 | }) |
|
729 | 730 | } |
|
730 | 731 | |
|
731 | impl<'on_disk> super::dispatch::DirstateMapMethods for DirstateMap<'on_disk> { | |
|
732 | fn clear(&mut self) { | |
|
733 | self.root = Default::default(); | |
|
734 | self.nodes_with_entry_count = 0; | |
|
735 |
|
|
|
732 | impl OwningDirstateMap { | |
|
733 | pub fn clear(&mut self) { | |
|
734 | let map = self.get_map_mut(); | |
|
735 | map.root = Default::default(); | |
|
736 | map.nodes_with_entry_count = 0; | |
|
737 | map.nodes_with_copy_source_count = 0; | |
|
736 | 738 | } |
|
737 | 739 | |
|
738 | fn set_entry( | |
|
740 | pub fn set_entry( | |
|
739 | 741 | &mut self, |
|
740 | 742 | filename: &HgPath, |
|
741 | 743 | entry: DirstateEntry, |
|
742 | 744 | ) -> Result<(), DirstateV2ParseError> { |
|
743 | self.get_or_insert(&filename)?.data = NodeData::Entry(entry); | |
|
745 | let map = self.get_map_mut(); | |
|
746 | map.get_or_insert(&filename)?.data = NodeData::Entry(entry); | |
|
744 | 747 | Ok(()) |
|
745 | 748 | } |
|
746 | 749 | |
|
747 | fn add_file( | |
|
750 | pub fn add_file( | |
|
748 | 751 | &mut self, |
|
749 | 752 | filename: &HgPath, |
|
750 | 753 | entry: DirstateEntry, |
|
751 | 754 | ) -> Result<(), DirstateError> { |
|
752 | 755 | let old_state = self.get(filename)?.map(|e| e.state()); |
|
753 | Ok(self.add_or_remove_file(filename, old_state, entry)?) | |
|
756 | let map = self.get_map_mut(); | |
|
757 | Ok(map.add_or_remove_file(filename, old_state, entry)?) | |
|
754 | 758 | } |
|
755 | 759 | |
|
756 | fn remove_file( | |
|
760 | pub fn remove_file( | |
|
757 | 761 | &mut self, |
|
758 | 762 | filename: &HgPath, |
|
759 | 763 | in_merge: bool, |
@@ -781,17 +785,19 b" impl<'on_disk> super::dispatch::Dirstate" | |||
|
781 | 785 | if size == 0 { |
|
782 | 786 | self.copy_map_remove(filename)?; |
|
783 | 787 | } |
|
788 | let map = self.get_map_mut(); | |
|
784 | 789 | let entry = DirstateEntry::new_removed(size); |
|
785 |
Ok( |
|
|
790 | Ok(map.add_or_remove_file(filename, old_state, entry)?) | |
|
786 | 791 | } |
|
787 | 792 | |
|
788 | fn drop_entry_and_copy_source( | |
|
793 | pub fn drop_entry_and_copy_source( | |
|
789 | 794 | &mut self, |
|
790 | 795 | filename: &HgPath, |
|
791 | 796 | ) -> Result<(), DirstateError> { |
|
792 | 797 | let was_tracked = self |
|
793 | 798 | .get(filename)? |
|
794 | 799 | .map_or(false, |e| e.state().is_tracked()); |
|
800 | let map = self.get_map_mut(); | |
|
795 | 801 | struct Dropped { |
|
796 | 802 | was_tracked: bool, |
|
797 | 803 | had_entry: bool, |
@@ -879,16 +885,16 b" impl<'on_disk> super::dispatch::Dirstate" | |||
|
879 | 885 | } |
|
880 | 886 | |
|
881 | 887 | if let Some((dropped, _removed)) = recur( |
|
882 |
|
|
|
883 |
&mut |
|
|
884 |
&mut |
|
|
888 | map.on_disk, | |
|
889 | &mut map.unreachable_bytes, | |
|
890 | &mut map.root, | |
|
885 | 891 | filename, |
|
886 | 892 | )? { |
|
887 | 893 | if dropped.had_entry { |
|
888 |
|
|
|
894 | map.nodes_with_entry_count -= 1 | |
|
889 | 895 | } |
|
890 | 896 | if dropped.had_copy_source { |
|
891 |
|
|
|
897 | map.nodes_with_copy_source_count -= 1 | |
|
892 | 898 | } |
|
893 | 899 | } else { |
|
894 | 900 | debug_assert!(!was_tracked); |
@@ -896,11 +902,12 b" impl<'on_disk> super::dispatch::Dirstate" | |||
|
896 | 902 | Ok(()) |
|
897 | 903 | } |
|
898 | 904 | |
|
899 | fn has_tracked_dir( | |
|
905 | pub fn has_tracked_dir( | |
|
900 | 906 | &mut self, |
|
901 | 907 | directory: &HgPath, |
|
902 | 908 | ) -> Result<bool, DirstateError> { |
|
903 | if let Some(node) = self.get_node(directory)? { | |
|
909 | let map = self.get_map_mut(); | |
|
910 | if let Some(node) = map.get_node(directory)? { | |
|
904 | 911 | // A node without a `DirstateEntry` was created to hold child |
|
905 | 912 | // nodes, and is therefore a directory. |
|
906 | 913 | let state = node.state()?; |
@@ -910,8 +917,12 b" impl<'on_disk> super::dispatch::Dirstate" | |||
|
910 | 917 | } |
|
911 | 918 | } |
|
912 | 919 | |
|
913 | fn has_dir(&mut self, directory: &HgPath) -> Result<bool, DirstateError> { | |
|
914 | if let Some(node) = self.get_node(directory)? { | |
|
920 | pub fn has_dir( | |
|
921 | &mut self, | |
|
922 | directory: &HgPath, | |
|
923 | ) -> Result<bool, DirstateError> { | |
|
924 | let map = self.get_map_mut(); | |
|
925 | if let Some(node) = map.get_node(directory)? { | |
|
915 | 926 | // A node without a `DirstateEntry` was created to hold child |
|
916 | 927 | // nodes, and is therefore a directory. |
|
917 | 928 | let state = node.state()?; |
@@ -922,43 +933,44 b" impl<'on_disk> super::dispatch::Dirstate" | |||
|
922 | 933 | } |
|
923 | 934 | |
|
924 | 935 | #[timed] |
|
925 | fn pack_v1( | |
|
936 | pub fn pack_v1( | |
|
926 | 937 | &mut self, |
|
927 | 938 | parents: DirstateParents, |
|
928 | 939 | now: Timestamp, |
|
929 | 940 | ) -> Result<Vec<u8>, DirstateError> { |
|
941 | let map = self.get_map_mut(); | |
|
930 | 942 | let now: i32 = now.0.try_into().expect("time overflow"); |
|
931 | 943 | let mut ambiguous_mtimes = Vec::new(); |
|
932 | 944 | // Optizimation (to be measured?): pre-compute size to avoid `Vec` |
|
933 | 945 | // reallocations |
|
934 | 946 | let mut size = parents.as_bytes().len(); |
|
935 |
for node in |
|
|
947 | for node in map.iter_nodes() { | |
|
936 | 948 | let node = node?; |
|
937 | 949 | if let Some(entry) = node.entry()? { |
|
938 | 950 | size += packed_entry_size( |
|
939 |
node.full_path( |
|
|
940 |
node.copy_source( |
|
|
951 | node.full_path(map.on_disk)?, | |
|
952 | node.copy_source(map.on_disk)?, | |
|
941 | 953 | ); |
|
942 | 954 | if entry.mtime_is_ambiguous(now) { |
|
943 | 955 | ambiguous_mtimes.push( |
|
944 |
node.full_path_borrowed( |
|
|
956 | node.full_path_borrowed(map.on_disk)? | |
|
945 | 957 | .detach_from_tree(), |
|
946 | 958 | ) |
|
947 | 959 | } |
|
948 | 960 | } |
|
949 | 961 | } |
|
950 |
|
|
|
962 | map.clear_known_ambiguous_mtimes(&ambiguous_mtimes)?; | |
|
951 | 963 | |
|
952 | 964 | let mut packed = Vec::with_capacity(size); |
|
953 | 965 | packed.extend(parents.as_bytes()); |
|
954 | 966 | |
|
955 |
for node in |
|
|
967 | for node in map.iter_nodes() { | |
|
956 | 968 | let node = node?; |
|
957 | 969 | if let Some(entry) = node.entry()? { |
|
958 | 970 | pack_entry( |
|
959 |
node.full_path( |
|
|
971 | node.full_path(map.on_disk)?, | |
|
960 | 972 | &entry, |
|
961 |
node.copy_source( |
|
|
973 | node.copy_source(map.on_disk)?, | |
|
962 | 974 | &mut packed, |
|
963 | 975 | ); |
|
964 | 976 | } |
@@ -968,23 +980,24 b" impl<'on_disk> super::dispatch::Dirstate" | |||
|
968 | 980 | |
|
969 | 981 | /// Returns new data and metadata together with whether that data should be |
|
970 | 982 | /// appended to the existing data file whose content is at |
|
971 |
/// ` |
|
|
983 | /// `map.on_disk` (true), instead of written to a new data file | |
|
972 | 984 | /// (false). |
|
973 | 985 | #[timed] |
|
974 | fn pack_v2( | |
|
986 | pub fn pack_v2( | |
|
975 | 987 | &mut self, |
|
976 | 988 | now: Timestamp, |
|
977 | 989 | can_append: bool, |
|
978 | 990 | ) -> Result<(Vec<u8>, Vec<u8>, bool), DirstateError> { |
|
991 | let map = self.get_map_mut(); | |
|
979 | 992 | // TODO: how do we want to handle this in 2038? |
|
980 | 993 | let now: i32 = now.0.try_into().expect("time overflow"); |
|
981 | 994 | let mut paths = Vec::new(); |
|
982 |
for node in |
|
|
995 | for node in map.iter_nodes() { | |
|
983 | 996 | let node = node?; |
|
984 | 997 | if let Some(entry) = node.entry()? { |
|
985 | 998 | if entry.mtime_is_ambiguous(now) { |
|
986 | 999 | paths.push( |
|
987 |
node.full_path_borrowed( |
|
|
1000 | node.full_path_borrowed(map.on_disk)? | |
|
988 | 1001 | .detach_from_tree(), |
|
989 | 1002 | ) |
|
990 | 1003 | } |
@@ -992,12 +1005,12 b" impl<'on_disk> super::dispatch::Dirstate" | |||
|
992 | 1005 | } |
|
993 | 1006 | // Borrow of `self` ends here since we collect cloned paths |
|
994 | 1007 | |
|
995 |
|
|
|
1008 | map.clear_known_ambiguous_mtimes(&paths)?; | |
|
996 | 1009 | |
|
997 |
on_disk::write( |
|
|
1010 | on_disk::write(map, can_append) | |
|
998 | 1011 | } |
|
999 | 1012 | |
|
1000 | fn status<'a>( | |
|
1013 | pub fn status<'a>( | |
|
1001 | 1014 | &'a mut self, |
|
1002 | 1015 | matcher: &'a (dyn Matcher + Sync), |
|
1003 | 1016 | root_dir: PathBuf, |
@@ -1005,119 +1018,129 b" impl<'on_disk> super::dispatch::Dirstate" | |||
|
1005 | 1018 | options: StatusOptions, |
|
1006 | 1019 | ) -> Result<(DirstateStatus<'a>, Vec<PatternFileWarning>), StatusError> |
|
1007 | 1020 | { |
|
1008 | super::status::status(self, matcher, root_dir, ignore_files, options) | |
|
1021 | let map = self.get_map_mut(); | |
|
1022 | super::status::status(map, matcher, root_dir, ignore_files, options) | |
|
1009 | 1023 | } |
|
1010 | 1024 | |
|
1011 | fn copy_map_len(&self) -> usize { | |
|
1012 | self.nodes_with_copy_source_count as usize | |
|
1025 | pub fn copy_map_len(&self) -> usize { | |
|
1026 | let map = self.get_map(); | |
|
1027 | map.nodes_with_copy_source_count as usize | |
|
1013 | 1028 | } |
|
1014 | 1029 | |
|
1015 | fn copy_map_iter(&self) -> CopyMapIter<'_> { | |
|
1016 | Box::new(filter_map_results(self.iter_nodes(), move |node| { | |
|
1017 | Ok(if let Some(source) = node.copy_source(self.on_disk)? { | |
|
1018 | Some((node.full_path(self.on_disk)?, source)) | |
|
1030 | pub fn copy_map_iter(&self) -> CopyMapIter<'_> { | |
|
1031 | let map = self.get_map(); | |
|
1032 | Box::new(filter_map_results(map.iter_nodes(), move |node| { | |
|
1033 | Ok(if let Some(source) = node.copy_source(map.on_disk)? { | |
|
1034 | Some((node.full_path(map.on_disk)?, source)) | |
|
1019 | 1035 | } else { |
|
1020 | 1036 | None |
|
1021 | 1037 | }) |
|
1022 | 1038 | })) |
|
1023 | 1039 | } |
|
1024 | 1040 | |
|
1025 | fn copy_map_contains_key( | |
|
1041 | pub fn copy_map_contains_key( | |
|
1026 | 1042 | &self, |
|
1027 | 1043 | key: &HgPath, |
|
1028 | 1044 | ) -> Result<bool, DirstateV2ParseError> { |
|
1029 |
|
|
|
1045 | let map = self.get_map(); | |
|
1046 | Ok(if let Some(node) = map.get_node(key)? { | |
|
1030 | 1047 | node.has_copy_source() |
|
1031 | 1048 | } else { |
|
1032 | 1049 | false |
|
1033 | 1050 | }) |
|
1034 | 1051 | } |
|
1035 | 1052 | |
|
1036 | fn copy_map_get( | |
|
1053 | pub fn copy_map_get( | |
|
1037 | 1054 | &self, |
|
1038 | 1055 | key: &HgPath, |
|
1039 | 1056 | ) -> Result<Option<&HgPath>, DirstateV2ParseError> { |
|
1040 |
|
|
|
1041 |
|
|
|
1057 | let map = self.get_map(); | |
|
1058 | if let Some(node) = map.get_node(key)? { | |
|
1059 | if let Some(source) = node.copy_source(map.on_disk)? { | |
|
1042 | 1060 | return Ok(Some(source)); |
|
1043 | 1061 | } |
|
1044 | 1062 | } |
|
1045 | 1063 | Ok(None) |
|
1046 | 1064 | } |
|
1047 | 1065 | |
|
1048 | fn copy_map_remove( | |
|
1066 | pub fn copy_map_remove( | |
|
1049 | 1067 | &mut self, |
|
1050 | 1068 | key: &HgPath, |
|
1051 | 1069 | ) -> Result<Option<HgPathBuf>, DirstateV2ParseError> { |
|
1052 | let count = &mut self.nodes_with_copy_source_count; | |
|
1053 | let unreachable_bytes = &mut self.unreachable_bytes; | |
|
1054 | Ok(Self::get_node_mut( | |
|
1055 | self.on_disk, | |
|
1070 | let map = self.get_map_mut(); | |
|
1071 | let count = &mut map.nodes_with_copy_source_count; | |
|
1072 | let unreachable_bytes = &mut map.unreachable_bytes; | |
|
1073 | Ok(DirstateMap::get_node_mut( | |
|
1074 | map.on_disk, | |
|
1056 | 1075 | unreachable_bytes, |
|
1057 |
&mut |
|
|
1076 | &mut map.root, | |
|
1058 | 1077 | key, |
|
1059 | 1078 | )? |
|
1060 | 1079 | .and_then(|node| { |
|
1061 | 1080 | if let Some(source) = &node.copy_source { |
|
1062 | 1081 | *count -= 1; |
|
1063 |
|
|
|
1082 | DirstateMap::count_dropped_path(unreachable_bytes, source); | |
|
1064 | 1083 | } |
|
1065 | 1084 | node.copy_source.take().map(Cow::into_owned) |
|
1066 | 1085 | })) |
|
1067 | 1086 | } |
|
1068 | 1087 | |
|
1069 | fn copy_map_insert( | |
|
1088 | pub fn copy_map_insert( | |
|
1070 | 1089 | &mut self, |
|
1071 | 1090 | key: HgPathBuf, |
|
1072 | 1091 | value: HgPathBuf, |
|
1073 | 1092 | ) -> Result<Option<HgPathBuf>, DirstateV2ParseError> { |
|
1074 |
let |
|
|
1075 | self.on_disk, | |
|
1076 | &mut self.unreachable_bytes, | |
|
1077 | &mut self.root, | |
|
1093 | let map = self.get_map_mut(); | |
|
1094 | let node = DirstateMap::get_or_insert_node( | |
|
1095 | map.on_disk, | |
|
1096 | &mut map.unreachable_bytes, | |
|
1097 | &mut map.root, | |
|
1078 | 1098 | &key, |
|
1079 | 1099 | WithBasename::to_cow_owned, |
|
1080 | 1100 | |_ancestor| {}, |
|
1081 | 1101 | )?; |
|
1082 | 1102 | if node.copy_source.is_none() { |
|
1083 |
|
|
|
1103 | map.nodes_with_copy_source_count += 1 | |
|
1084 | 1104 | } |
|
1085 | 1105 | Ok(node.copy_source.replace(value.into()).map(Cow::into_owned)) |
|
1086 | 1106 | } |
|
1087 | 1107 | |
|
1088 | fn len(&self) -> usize { | |
|
1089 | self.nodes_with_entry_count as usize | |
|
1108 | pub fn len(&self) -> usize { | |
|
1109 | let map = self.get_map(); | |
|
1110 | map.nodes_with_entry_count as usize | |
|
1090 | 1111 | } |
|
1091 | 1112 | |
|
1092 | fn contains_key( | |
|
1113 | pub fn contains_key( | |
|
1093 | 1114 | &self, |
|
1094 | 1115 | key: &HgPath, |
|
1095 | 1116 | ) -> Result<bool, DirstateV2ParseError> { |
|
1096 | 1117 | Ok(self.get(key)?.is_some()) |
|
1097 | 1118 | } |
|
1098 | 1119 | |
|
1099 | fn get( | |
|
1120 | pub fn get( | |
|
1100 | 1121 | &self, |
|
1101 | 1122 | key: &HgPath, |
|
1102 | 1123 | ) -> Result<Option<DirstateEntry>, DirstateV2ParseError> { |
|
1103 |
|
|
|
1124 | let map = self.get_map(); | |
|
1125 | Ok(if let Some(node) = map.get_node(key)? { | |
|
1104 | 1126 | node.entry()? |
|
1105 | 1127 | } else { |
|
1106 | 1128 | None |
|
1107 | 1129 | }) |
|
1108 | 1130 | } |
|
1109 | 1131 | |
|
1110 | fn iter(&self) -> StateMapIter<'_> { | |
|
1111 | Box::new(filter_map_results(self.iter_nodes(), move |node| { | |
|
1132 | pub fn iter(&self) -> StateMapIter<'_> { | |
|
1133 | let map = self.get_map(); | |
|
1134 | Box::new(filter_map_results(map.iter_nodes(), move |node| { | |
|
1112 | 1135 | Ok(if let Some(entry) = node.entry()? { |
|
1113 |
Some((node.full_path( |
|
|
1136 | Some((node.full_path(map.on_disk)?, entry)) | |
|
1114 | 1137 | } else { |
|
1115 | 1138 | None |
|
1116 | 1139 | }) |
|
1117 | 1140 | })) |
|
1118 | 1141 | } |
|
1119 | 1142 | |
|
1120 | fn iter_tracked_dirs( | |
|
1143 | pub fn iter_tracked_dirs( | |
|
1121 | 1144 | &mut self, |
|
1122 | 1145 | ) -> Result< |
|
1123 | 1146 | Box< |
@@ -1127,9 +1150,10 b" impl<'on_disk> super::dispatch::Dirstate" | |||
|
1127 | 1150 | >, |
|
1128 | 1151 | DirstateError, |
|
1129 | 1152 | > { |
|
1130 |
let |
|
|
1153 | let map = self.get_map_mut(); | |
|
1154 | let on_disk = map.on_disk; | |
|
1131 | 1155 | Ok(Box::new(filter_map_results( |
|
1132 |
|
|
|
1156 | map.iter_nodes(), | |
|
1133 | 1157 | move |node| { |
|
1134 | 1158 | Ok(if node.tracked_descendants_count() > 0 { |
|
1135 | 1159 | Some(node.full_path(on_disk)?) |
@@ -1140,7 +1164,7 b" impl<'on_disk> super::dispatch::Dirstate" | |||
|
1140 | 1164 | ))) |
|
1141 | 1165 | } |
|
1142 | 1166 | |
|
1143 | fn debug_iter( | |
|
1167 | pub fn debug_iter( | |
|
1144 | 1168 | &self, |
|
1145 | 1169 | all: bool, |
|
1146 | 1170 | ) -> Box< |
@@ -1152,7 +1176,8 b" impl<'on_disk> super::dispatch::Dirstate" | |||
|
1152 | 1176 | > + Send |
|
1153 | 1177 | + '_, |
|
1154 | 1178 | > { |
|
1155 | Box::new(filter_map_results(self.iter_nodes(), move |node| { | |
|
1179 | let map = self.get_map(); | |
|
1180 | Box::new(filter_map_results(map.iter_nodes(), move |node| { | |
|
1156 | 1181 | let debug_tuple = if let Some(entry) = node.entry()? { |
|
1157 | 1182 | entry.debug_tuple() |
|
1158 | 1183 | } else if !all { |
@@ -1162,7 +1187,7 b" impl<'on_disk> super::dispatch::Dirstate" | |||
|
1162 | 1187 | } else { |
|
1163 | 1188 | (b' ', 0, -1, -1) |
|
1164 | 1189 | }; |
|
1165 |
Ok(Some((node.full_path( |
|
|
1190 | Ok(Some((node.full_path(map.on_disk)?, debug_tuple))) | |
|
1166 | 1191 | })) |
|
1167 | 1192 | } |
|
1168 | 1193 | } |
@@ -44,7 +44,7 b' impl OwningDirstateMap {' | |||
|
44 | 44 | Self { on_disk, ptr } |
|
45 | 45 | } |
|
46 | 46 | |
|
47 |
pub fn get_ |
|
|
47 | pub fn get_pair_mut<'a>( | |
|
48 | 48 | &'a mut self, |
|
49 | 49 | ) -> (&'a [u8], &'a mut DirstateMap<'a>) { |
|
50 | 50 | // SAFETY: We cast the type-erased pointer back to the same type it had |
@@ -60,11 +60,11 b' impl OwningDirstateMap {' | |||
|
60 | 60 | (&self.on_disk, unsafe { &mut *ptr }) |
|
61 | 61 | } |
|
62 | 62 | |
|
63 | pub fn get_mut<'a>(&'a mut self) -> &'a mut DirstateMap<'a> { | |
|
64 |
self.get_ |
|
|
63 | pub fn get_map_mut<'a>(&'a mut self) -> &'a mut DirstateMap<'a> { | |
|
64 | self.get_pair_mut().1 | |
|
65 | 65 | } |
|
66 | 66 | |
|
67 | pub fn get<'a>(&'a self) -> &'a DirstateMap<'a> { | |
|
67 | pub fn get_map<'a>(&'a self) -> &'a DirstateMap<'a> { | |
|
68 | 68 | // SAFETY: same reasoning as in `get_mut` above. |
|
69 | 69 | let ptr: *mut DirstateMap<'a> = self.ptr.cast(); |
|
70 | 70 | unsafe { &*ptr } |
@@ -294,12 +294,12 b' impl Repo {' | |||
|
294 | 294 | } else { |
|
295 | 295 | OwningDirstateMap::new_empty(Vec::new()) |
|
296 | 296 | }; |
|
297 |
let (on_disk, placeholder) = map.get_ |
|
|
297 | let (on_disk, placeholder) = map.get_pair_mut(); | |
|
298 | 298 | *placeholder = DirstateMap::new_v2(on_disk, data_size, metadata)?; |
|
299 | 299 | Ok(map) |
|
300 | 300 | } else { |
|
301 | 301 | let mut map = OwningDirstateMap::new_empty(dirstate_file_contents); |
|
302 |
let (on_disk, placeholder) = map.get_ |
|
|
302 | let (on_disk, placeholder) = map.get_pair_mut(); | |
|
303 | 303 | let (inner, parents) = DirstateMap::new_v1(on_disk)?; |
|
304 | 304 | self.dirstate_parents |
|
305 | 305 | .set(Some(parents.unwrap_or(DirstateParents::NULL))); |
@@ -25,7 +25,6 b' use hg::{' | |||
|
25 | 25 | dirstate::parsers::Timestamp, |
|
26 | 26 | dirstate::StateMapIter, |
|
27 | 27 | dirstate_tree::dirstate_map::DirstateMap as TreeDirstateMap, |
|
28 | dirstate_tree::dispatch::DirstateMapMethods, | |
|
29 | 28 | dirstate_tree::on_disk::DirstateV2ParseError, |
|
30 | 29 | dirstate_tree::owning::OwningDirstateMap, |
|
31 | 30 | revlog::Node, |
@@ -47,7 +46,7 b' use hg::{' | |||
|
47 | 46 | // All attributes also have to have a separate refcount data attribute for |
|
48 | 47 | // leaks, with all methods that go along for reference sharing. |
|
49 | 48 | py_class!(pub class DirstateMap |py| { |
|
50 |
@shared data inner: |
|
|
49 | @shared data inner: OwningDirstateMap; | |
|
51 | 50 | |
|
52 | 51 | /// Returns a `(dirstate_map, parents)` tuple |
|
53 | 52 | @staticmethod |
@@ -56,12 +55,12 b' py_class!(pub class DirstateMap |py| {' | |||
|
56 | 55 | ) -> PyResult<PyObject> { |
|
57 | 56 | let on_disk = PyBytesDeref::new(py, on_disk); |
|
58 | 57 | let mut map = OwningDirstateMap::new_empty(on_disk); |
|
59 |
let (on_disk, map_placeholder) = map.get_ |
|
|
58 | let (on_disk, map_placeholder) = map.get_pair_mut(); | |
|
60 | 59 | |
|
61 | 60 | let (actual_map, parents) = TreeDirstateMap::new_v1(on_disk) |
|
62 | 61 | .map_err(|e| dirstate_error(py, e))?; |
|
63 | 62 | *map_placeholder = actual_map; |
|
64 |
let map = Self::create_instance(py, |
|
|
63 | let map = Self::create_instance(py, map)?; | |
|
65 | 64 | let parents = parents.map(|p| { |
|
66 | 65 | let p1 = PyBytes::new(py, p.p1.as_bytes()); |
|
67 | 66 | let p2 = PyBytes::new(py, p.p2.as_bytes()); |
@@ -82,11 +81,11 b' py_class!(pub class DirstateMap |py| {' | |||
|
82 | 81 | }; |
|
83 | 82 | let on_disk = PyBytesDeref::new(py, on_disk); |
|
84 | 83 | let mut map = OwningDirstateMap::new_empty(on_disk); |
|
85 |
let (on_disk, map_placeholder) = map.get_ |
|
|
84 | let (on_disk, map_placeholder) = map.get_pair_mut(); | |
|
86 | 85 | *map_placeholder = TreeDirstateMap::new_v2( |
|
87 | 86 | on_disk, data_size, tree_metadata.data(py), |
|
88 | 87 | ).map_err(dirstate_error)?; |
|
89 |
let map = Self::create_instance(py, |
|
|
88 | let map = Self::create_instance(py, map)?; | |
|
90 | 89 | Ok(map.into_object()) |
|
91 | 90 | } |
|
92 | 91 | |
@@ -452,7 +451,7 b' impl DirstateMap {' | |||
|
452 | 451 | pub fn get_inner_mut<'a>( |
|
453 | 452 | &'a self, |
|
454 | 453 | py: Python<'a>, |
|
455 |
) -> RefMut<'a, |
|
|
454 | ) -> RefMut<'a, OwningDirstateMap> { | |
|
456 | 455 | self.inner(py).borrow_mut() |
|
457 | 456 | } |
|
458 | 457 | fn translate_key( |
@@ -9,7 +9,6 b' use crate::error::CommandError;' | |||
|
9 | 9 | use crate::ui::Ui; |
|
10 | 10 | use clap::{Arg, SubCommand}; |
|
11 | 11 | use hg; |
|
12 | use hg::dirstate_tree::dispatch::DirstateMapMethods; | |
|
13 | 12 | use hg::errors::HgError; |
|
14 | 13 | use hg::manifest::Manifest; |
|
15 | 14 | use hg::matchers::AlwaysMatcher; |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now