##// END OF EJS Templates
dirstate-tree: Empty shell for a second Rust DirstateMap implementation...
Simon Sapin -
r47865:473abf47 default
parent child Browse files
Show More
@@ -0,0 +1,216 b''
1 use std::path::PathBuf;
2 use std::time::Duration;
3
4 use crate::matchers::Matcher;
5 use crate::utils::hg_path::{HgPath, HgPathBuf};
6 use crate::CopyMapIter;
7 use crate::DirstateEntry;
8 use crate::DirstateError;
9 use crate::DirstateMapError;
10 use crate::DirstateParents;
11 use crate::DirstateStatus;
12 use crate::EntryState;
13 use crate::FastHashMap;
14 use crate::HgPathCow;
15 use crate::PatternFileWarning;
16 use crate::StateMapIter;
17 use crate::StatusError;
18 use crate::StatusOptions;
19
20 pub struct DirstateMap {
21 // TODO
22 }
23
24 impl DirstateMap {
25 pub fn new() -> Self {
26 todo!()
27 }
28 }
29
30 impl super::dispatch::DirstateMapMethods for DirstateMap {
31 fn clear(&mut self) {
32 todo!()
33 }
34
35 fn add_file(
36 &mut self,
37 _filename: &HgPath,
38 _old_state: EntryState,
39 _entry: DirstateEntry,
40 ) -> Result<(), DirstateMapError> {
41 todo!()
42 }
43
44 fn remove_file(
45 &mut self,
46 _filename: &HgPath,
47 _old_state: EntryState,
48 _size: i32,
49 ) -> Result<(), DirstateMapError> {
50 todo!()
51 }
52
53 fn drop_file(
54 &mut self,
55 _filename: &HgPath,
56 _old_state: EntryState,
57 ) -> Result<bool, DirstateMapError> {
58 todo!()
59 }
60
61 fn clear_ambiguous_times(
62 &mut self,
63 _filenames: Vec<HgPathBuf>,
64 _now: i32,
65 ) {
66 todo!()
67 }
68
69 fn non_normal_entries_contains(&mut self, _key: &HgPath) -> bool {
70 todo!()
71 }
72
73 fn non_normal_entries_remove(&mut self, _key: &HgPath) -> bool {
74 todo!()
75 }
76
77 fn non_normal_or_other_parent_paths(
78 &mut self,
79 ) -> Box<dyn Iterator<Item = &HgPathBuf> + '_> {
80 todo!()
81 }
82
83 fn set_non_normal_other_parent_entries(&mut self, _force: bool) {
84 todo!()
85 }
86
87 fn iter_non_normal_paths(
88 &mut self,
89 ) -> Box<dyn Iterator<Item = &HgPathBuf> + Send + '_> {
90 todo!()
91 }
92
93 fn iter_non_normal_paths_panic(
94 &self,
95 ) -> Box<dyn Iterator<Item = &HgPathBuf> + Send + '_> {
96 todo!()
97 }
98
99 fn iter_other_parent_paths(
100 &mut self,
101 ) -> Box<dyn Iterator<Item = &HgPathBuf> + Send + '_> {
102 todo!()
103 }
104
105 fn has_tracked_dir(
106 &mut self,
107 _directory: &HgPath,
108 ) -> Result<bool, DirstateMapError> {
109 todo!()
110 }
111
112 fn has_dir(
113 &mut self,
114 _directory: &HgPath,
115 ) -> Result<bool, DirstateMapError> {
116 todo!()
117 }
118
119 fn parents(
120 &mut self,
121 _file_contents: &[u8],
122 ) -> Result<&DirstateParents, DirstateError> {
123 todo!()
124 }
125
126 fn set_parents(&mut self, _parents: &DirstateParents) {
127 todo!()
128 }
129
130 fn read<'a>(
131 &mut self,
132 _file_contents: &'a [u8],
133 ) -> Result<Option<&'a DirstateParents>, DirstateError> {
134 todo!()
135 }
136
137 fn pack(
138 &mut self,
139 _parents: DirstateParents,
140 _now: Duration,
141 ) -> Result<Vec<u8>, DirstateError> {
142 todo!()
143 }
144
145 fn build_file_fold_map(&mut self) -> &FastHashMap<HgPathBuf, HgPathBuf> {
146 todo!()
147 }
148
149 fn set_all_dirs(&mut self) -> Result<(), DirstateMapError> {
150 todo!()
151 }
152
153 fn set_dirs(&mut self) -> Result<(), DirstateMapError> {
154 todo!()
155 }
156
157 fn status<'a>(
158 &'a self,
159 _matcher: &'a (dyn Matcher + Sync),
160 _root_dir: PathBuf,
161 _ignore_files: Vec<PathBuf>,
162 _options: StatusOptions,
163 ) -> Result<
164 (
165 (Vec<HgPathCow<'a>>, DirstateStatus<'a>),
166 Vec<PatternFileWarning>,
167 ),
168 StatusError,
169 > {
170 todo!()
171 }
172
173 fn copy_map_len(&self) -> usize {
174 todo!()
175 }
176
177 fn copy_map_iter(&self) -> CopyMapIter<'_> {
178 todo!()
179 }
180
181 fn copy_map_contains_key(&self, _key: &HgPath) -> bool {
182 todo!()
183 }
184
185 fn copy_map_get(&self, _key: &HgPath) -> Option<&HgPathBuf> {
186 todo!()
187 }
188
189 fn copy_map_remove(&mut self, _key: &HgPath) -> Option<HgPathBuf> {
190 todo!()
191 }
192
193 fn copy_map_insert(
194 &mut self,
195 _key: HgPathBuf,
196 _value: HgPathBuf,
197 ) -> Option<HgPathBuf> {
198 todo!()
199 }
200
201 fn len(&self) -> usize {
202 todo!()
203 }
204
205 fn contains_key(&self, _key: &HgPath) -> bool {
206 todo!()
207 }
208
209 fn get(&self, _key: &HgPath) -> Option<&DirstateEntry> {
210 todo!()
211 }
212
213 fn iter(&self) -> StateMapIter<'_> {
214 todo!()
215 }
216 }
@@ -959,6 +959,11 b' coreconfigitem('
959 959 )
960 960 coreconfigitem(
961 961 b'experimental',
962 b'dirstate-tree.in-memory',
963 default=False,
964 )
965 coreconfigitem(
966 b'experimental',
962 967 b'editortmpinhg',
963 968 default=False,
964 969 )
@@ -1790,7 +1790,12 b' if rustmod is not None:'
1790 1790 Does not fill the Dirstatemap when called. This allows for
1791 1791 optimizations where only setting/getting the parents is needed.
1792 1792 """
1793 self._inner_rustmap = rustmod.DirstateMap(self._root)
1793 use_dirstate_tree = self._ui.configbool(
1794 b"experimental",
1795 b"dirstate-tree.in-memory",
1796 False,
1797 )
1798 self._inner_rustmap = rustmod.DirstateMap(use_dirstate_tree)
1794 1799 return self._inner_rustmap
1795 1800
1796 1801 @property
@@ -1,1 +1,2 b''
1 pub mod dirstate_map;
1 2 pub mod dispatch;
@@ -50,8 +50,12 b' use hg::{'
50 50 py_class!(pub class DirstateMap |py| {
51 51 @shared data inner: Box<dyn DirstateMapMethods + Send>;
52 52
53 def __new__(_cls, _root: PyObject) -> PyResult<Self> {
54 let inner = Box::new(RustDirstateMap::default());
53 def __new__(_cls, use_dirstate_tree: bool) -> PyResult<Self> {
54 let inner = if use_dirstate_tree {
55 Box::new(hg::dirstate_tree::dirstate_map::DirstateMap::new()) as _
56 } else {
57 Box::new(RustDirstateMap::default()) as _
58 };
55 59 Self::create_instance(py, inner)
56 60 }
57 61
General Comments 0
You need to be logged in to leave comments. Login now