Show More
@@ -1147,7 +1147,10 b' def perfdirs(ui, repo, **opts):' | |||
|
1147 | 1147 | |
|
1148 | 1148 | def d(): |
|
1149 | 1149 | dirstate.hasdir(b'a') |
|
1150 | del dirstate._map._dirs | |
|
1150 | try: | |
|
1151 | del dirstate._map._dirs | |
|
1152 | except AttributeError: | |
|
1153 | pass | |
|
1151 | 1154 | |
|
1152 | 1155 | timer(d) |
|
1153 | 1156 | fm.end() |
@@ -1225,7 +1228,10 b' def perfdirstatedirs(ui, repo, **opts):' | |||
|
1225 | 1228 | repo.dirstate.hasdir(b"a") |
|
1226 | 1229 | |
|
1227 | 1230 | def setup(): |
|
1228 | del repo.dirstate._map._dirs | |
|
1231 | try: | |
|
1232 | del repo.dirstate._map._dirs | |
|
1233 | except AttributeError: | |
|
1234 | pass | |
|
1229 | 1235 | |
|
1230 | 1236 | def d(): |
|
1231 | 1237 | repo.dirstate.hasdir(b"a") |
@@ -1268,7 +1274,10 b' def perfdirfoldmap(ui, repo, **opts):' | |||
|
1268 | 1274 | |
|
1269 | 1275 | def setup(): |
|
1270 | 1276 | del dirstate._map.dirfoldmap |
|
1271 | del dirstate._map._dirs | |
|
1277 | try: | |
|
1278 | del dirstate._map._dirs | |
|
1279 | except AttributeError: | |
|
1280 | pass | |
|
1272 | 1281 | |
|
1273 | 1282 | def d(): |
|
1274 | 1283 | dirstate._map.dirfoldmap.get(b'a') |
@@ -1951,22 +1951,12 b' if rustmod is not None:' | |||
|
1951 | 1951 | return self._rustmap.filefoldmapasdict() |
|
1952 | 1952 | |
|
1953 | 1953 | def hastrackeddir(self, d): |
|
1954 | self._dirs # Trigger Python's propertycache | |
|
1955 | 1954 | return self._rustmap.hastrackeddir(d) |
|
1956 | 1955 | |
|
1957 | 1956 | def hasdir(self, d): |
|
1958 | self._dirs # Trigger Python's propertycache | |
|
1959 | 1957 | return self._rustmap.hasdir(d) |
|
1960 | 1958 | |
|
1961 | 1959 | @propertycache |
|
1962 | def _dirs(self): | |
|
1963 | return self._rustmap.getdirs() | |
|
1964 | ||
|
1965 | @propertycache | |
|
1966 | def _alldirs(self): | |
|
1967 | return self._rustmap.getalldirs() | |
|
1968 | ||
|
1969 | @propertycache | |
|
1970 | 1960 | def identity(self): |
|
1971 | 1961 | self._rustmap |
|
1972 | 1962 | return self.identity |
@@ -1988,6 +1978,6 b' if rustmod is not None:' | |||
|
1988 | 1978 | def dirfoldmap(self): |
|
1989 | 1979 | f = {} |
|
1990 | 1980 | normcase = util.normcase |
|
1991 |
for name in self. |
|
|
1981 | for name, _pseudo_entry in self.directories(): | |
|
1992 | 1982 | f[normcase(name)] = name |
|
1993 | 1983 | return f |
@@ -977,18 +977,6 b" impl<'on_disk> super::dispatch::Dirstate" | |||
|
977 | 977 | on_disk::write(self, parents) |
|
978 | 978 | } |
|
979 | 979 | |
|
980 | fn set_all_dirs(&mut self) -> Result<(), DirstateError> { | |
|
981 | // Do nothing, this `DirstateMap` does not a separate `all_dirs` that | |
|
982 | // needs to be recomputed | |
|
983 | Ok(()) | |
|
984 | } | |
|
985 | ||
|
986 | fn set_dirs(&mut self) -> Result<(), DirstateError> { | |
|
987 | // Do nothing, this `DirstateMap` does not a separate `dirs` that needs | |
|
988 | // to be recomputed | |
|
989 | Ok(()) | |
|
990 | } | |
|
991 | ||
|
992 | 980 | fn status<'a>( |
|
993 | 981 | &'a mut self, |
|
994 | 982 | matcher: &'a (dyn Matcher + Sync), |
@@ -95,10 +95,6 b' pub trait DirstateMapMethods {' | |||
|
95 | 95 | now: Timestamp, |
|
96 | 96 | ) -> Result<Vec<u8>, DirstateError>; |
|
97 | 97 | |
|
98 | fn set_all_dirs(&mut self) -> Result<(), DirstateError>; | |
|
99 | ||
|
100 | fn set_dirs(&mut self) -> Result<(), DirstateError>; | |
|
101 | ||
|
102 | 98 | fn status<'a>( |
|
103 | 99 | &'a mut self, |
|
104 | 100 | matcher: &'a (dyn Matcher + Sync), |
@@ -281,14 +277,6 b' impl DirstateMapMethods for DirstateMap ' | |||
|
281 | 277 | ) |
|
282 | 278 | } |
|
283 | 279 | |
|
284 | fn set_all_dirs(&mut self) -> Result<(), DirstateError> { | |
|
285 | self.set_all_dirs() | |
|
286 | } | |
|
287 | ||
|
288 | fn set_dirs(&mut self) -> Result<(), DirstateError> { | |
|
289 | self.set_dirs() | |
|
290 | } | |
|
291 | ||
|
292 | 280 | fn status<'a>( |
|
293 | 281 | &'a mut self, |
|
294 | 282 | matcher: &'a (dyn Matcher + Sync), |
@@ -19,11 +19,11 b' use cpython::{' | |||
|
19 | 19 | |
|
20 | 20 | use crate::{ |
|
21 | 21 | dirstate::copymap::{CopyMap, CopyMapItemsIterator, CopyMapKeysIterator}, |
|
22 | dirstate::make_dirstate_tuple, | |
|
22 | 23 | dirstate::non_normal_entries::{ |
|
23 | 24 | NonNormalEntries, NonNormalEntriesIterator, |
|
24 | 25 | }, |
|
25 | 26 | dirstate::owning::OwningDirstateMap, |
|
26 | dirstate::{dirs_multiset::Dirs, make_dirstate_tuple}, | |
|
27 | 27 | parsers::dirstate_parents_to_pytuple, |
|
28 | 28 | }; |
|
29 | 29 | use hg::{ |
@@ -34,8 +34,8 b' use hg::{' | |||
|
34 | 34 | revlog::Node, |
|
35 | 35 | utils::files::normalize_case, |
|
36 | 36 | utils::hg_path::{HgPath, HgPathBuf}, |
|
37 | DirsMultiset, DirstateEntry, DirstateError, | |
|
38 |
|
|
|
37 | DirstateEntry, DirstateError, DirstateMap as RustDirstateMap, | |
|
38 | DirstateParents, EntryState, StateMapIter, | |
|
39 | 39 | }; |
|
40 | 40 | |
|
41 | 41 | // TODO |
@@ -391,40 +391,6 b' py_class!(pub class DirstateMap |py| {' | |||
|
391 | 391 | ) |
|
392 | 392 | } |
|
393 | 393 | |
|
394 | def getdirs(&self) -> PyResult<Dirs> { | |
|
395 | // TODO don't copy, share the reference | |
|
396 | self.inner(py).borrow_mut().set_dirs() | |
|
397 | .map_err(|e| { | |
|
398 | PyErr::new::<exc::ValueError, _>(py, e.to_string()) | |
|
399 | })?; | |
|
400 | Dirs::from_inner( | |
|
401 | py, | |
|
402 | DirsMultiset::from_dirstate( | |
|
403 | self.inner(py).borrow().iter(), | |
|
404 | Some(EntryState::Removed), | |
|
405 | ) | |
|
406 | .map_err(|e| { | |
|
407 | PyErr::new::<exc::ValueError, _>(py, e.to_string()) | |
|
408 | })?, | |
|
409 | ) | |
|
410 | } | |
|
411 | def getalldirs(&self) -> PyResult<Dirs> { | |
|
412 | // TODO don't copy, share the reference | |
|
413 | self.inner(py).borrow_mut().set_all_dirs() | |
|
414 | .map_err(|e| { | |
|
415 | PyErr::new::<exc::ValueError, _>(py, e.to_string()) | |
|
416 | })?; | |
|
417 | Dirs::from_inner( | |
|
418 | py, | |
|
419 | DirsMultiset::from_dirstate( | |
|
420 | self.inner(py).borrow().iter(), | |
|
421 | None, | |
|
422 | ).map_err(|e| { | |
|
423 | PyErr::new::<exc::ValueError, _>(py, e.to_string()) | |
|
424 | })?, | |
|
425 | ) | |
|
426 | } | |
|
427 | ||
|
428 | 394 | // TODO all copymap* methods, see docstring above |
|
429 | 395 | def copymapcopy(&self) -> PyResult<PyDict> { |
|
430 | 396 | let dict = PyDict::new(py); |
@@ -128,14 +128,6 b' impl DirstateMapMethods for OwningDirsta' | |||
|
128 | 128 | self.get_mut().pack_v2(parents, now) |
|
129 | 129 | } |
|
130 | 130 | |
|
131 | fn set_all_dirs(&mut self) -> Result<(), DirstateError> { | |
|
132 | self.get_mut().set_all_dirs() | |
|
133 | } | |
|
134 | ||
|
135 | fn set_dirs(&mut self) -> Result<(), DirstateError> { | |
|
136 | self.get_mut().set_dirs() | |
|
137 | } | |
|
138 | ||
|
139 | 131 | fn status<'a>( |
|
140 | 132 | &'a mut self, |
|
141 | 133 | matcher: &'a (dyn Matcher + Sync), |
General Comments 0
You need to be logged in to leave comments.
Login now