Show More
@@ -968,10 +968,7 b' def debugstate(ui, repo, **opts):' | |||
|
968 | 968 | ) # sort by mtime, then by filename |
|
969 | 969 | else: |
|
970 | 970 | keyfunc = None # sort by filename |
|
971 | if opts['all']: | |
|
972 | entries = list(repo.dirstate._map.debug_iter()) | |
|
973 | else: | |
|
974 | entries = list(pycompat.iteritems(repo.dirstate)) | |
|
971 | entries = list(repo.dirstate._map.debug_iter(all=opts['all'])) | |
|
975 | 972 | entries.sort(key=keyfunc) |
|
976 | 973 | for file_, ent in entries: |
|
977 | 974 | if ent.v1_mtime() == -1: |
@@ -118,7 +118,11 b' class dirstatemap(object):' | |||
|
118 | 118 | # forward for python2,3 compat |
|
119 | 119 | iteritems = items |
|
120 | 120 | |
|
121 | debug_iter = items | |
|
121 | def debug_iter(self, all): | |
|
122 | """ | |
|
123 | `all` is unused when Rust is not enabled | |
|
124 | """ | |
|
125 | return self.item() | |
|
122 | 126 | |
|
123 | 127 | def __len__(self): |
|
124 | 128 | return len(self._map) |
@@ -700,8 +704,8 b' if rustmod is not None:' | |||
|
700 | 704 | def copymap(self): |
|
701 | 705 | return self._rustmap.copymap() |
|
702 | 706 | |
|
703 | def debug_iter(self): | |
|
704 | return self._rustmap.debug_iter() | |
|
707 | def debug_iter(self, all): | |
|
708 | return self._rustmap.debug_iter(all) | |
|
705 | 709 | |
|
706 | 710 | def preload(self): |
|
707 | 711 | self._rustmap |
@@ -1289,6 +1289,7 b" impl<'on_disk> super::dispatch::Dirstate" | |||
|
1289 | 1289 | |
|
1290 | 1290 | fn debug_iter( |
|
1291 | 1291 | &self, |
|
1292 | all: bool, | |
|
1292 | 1293 | ) -> Box< |
|
1293 | 1294 | dyn Iterator< |
|
1294 | 1295 | Item = Result< |
@@ -1298,16 +1299,17 b" impl<'on_disk> super::dispatch::Dirstate" | |||
|
1298 | 1299 | > + Send |
|
1299 | 1300 | + '_, |
|
1300 | 1301 | > { |
|
1301 |
Box::new(self.iter_nodes() |
|
|
1302 | let node = node?; | |
|
1302 | Box::new(filter_map_results(self.iter_nodes(), move |node| { | |
|
1303 | 1303 | let debug_tuple = if let Some(entry) = node.entry()? { |
|
1304 | 1304 | entry.debug_tuple() |
|
1305 | } else if !all { | |
|
1306 | return Ok(None); | |
|
1305 | 1307 | } else if let Some(mtime) = node.cached_directory_mtime() { |
|
1306 | 1308 | (b' ', 0, -1, mtime.seconds() as i32) |
|
1307 | 1309 | } else { |
|
1308 | 1310 | (b' ', 0, -1, -1) |
|
1309 | 1311 | }; |
|
1310 | Ok((node.full_path(self.on_disk)?, debug_tuple)) | |
|
1312 | Ok(Some((node.full_path(self.on_disk)?, debug_tuple))) | |
|
1311 | 1313 | })) |
|
1312 | 1314 | } |
|
1313 | 1315 | } |
@@ -290,13 +290,15 b' pub trait DirstateMapMethods {' | |||
|
290 | 290 | /// node stored in this dirstate map, for the purpose of the `hg |
|
291 | 291 | /// debugdirstate` command. |
|
292 | 292 | /// |
|
293 | /// For nodes that don’t have an entry, `state` is the ASCII space. | |
|
293 | /// If `all` is true, include nodes that don’t have an entry. | |
|
294 | /// For such nodes `state` is the ASCII space. | |
|
294 | 295 | /// An `mtime` may still be present. It is used to optimize `status`. |
|
295 | 296 | /// |
|
296 | 297 | /// Because parse errors can happen during iteration, the iterated items |
|
297 | 298 | /// are `Result`s. |
|
298 | 299 | fn debug_iter( |
|
299 | 300 | &self, |
|
301 | all: bool, | |
|
300 | 302 | ) -> Box< |
|
301 | 303 | dyn Iterator< |
|
302 | 304 | Item = Result< |
@@ -538,6 +540,7 b' impl DirstateMapMethods for DirstateMap ' | |||
|
538 | 540 | |
|
539 | 541 | fn debug_iter( |
|
540 | 542 | &self, |
|
543 | all: bool, | |
|
541 | 544 | ) -> Box< |
|
542 | 545 | dyn Iterator< |
|
543 | 546 | Item = Result< |
@@ -547,6 +550,9 b' impl DirstateMapMethods for DirstateMap ' | |||
|
547 | 550 | > + Send |
|
548 | 551 | + '_, |
|
549 | 552 | > { |
|
553 | // Not used for the flat (not tree-based) DirstateMap | |
|
554 | let _ = all; | |
|
555 | ||
|
550 | 556 | Box::new( |
|
551 | 557 | (&**self) |
|
552 | 558 | .iter() |
@@ -226,6 +226,7 b' impl DirstateMapMethods for OwningDirsta' | |||
|
226 | 226 | |
|
227 | 227 | fn debug_iter( |
|
228 | 228 | &self, |
|
229 | all: bool, | |
|
229 | 230 | ) -> Box< |
|
230 | 231 | dyn Iterator< |
|
231 | 232 | Item = Result< |
@@ -235,6 +236,6 b' impl DirstateMapMethods for OwningDirsta' | |||
|
235 | 236 | > + Send |
|
236 | 237 | + '_, |
|
237 | 238 | > { |
|
238 | self.get().debug_iter() | |
|
239 | self.get().debug_iter(all) | |
|
239 | 240 | } |
|
240 | 241 | } |
@@ -606,9 +606,9 b' py_class!(pub class DirstateMap |py| {' | |||
|
606 | 606 | Ok(dirs) |
|
607 | 607 | } |
|
608 | 608 | |
|
609 | def debug_iter(&self) -> PyResult<PyList> { | |
|
609 | def debug_iter(&self, all: bool) -> PyResult<PyList> { | |
|
610 | 610 | let dirs = PyList::new(py, &[]); |
|
611 | for item in self.inner(py).borrow().debug_iter() { | |
|
611 | for item in self.inner(py).borrow().debug_iter(all) { | |
|
612 | 612 | let (path, (state, mode, size, mtime)) = |
|
613 | 613 | item.map_err(|e| v2_error(py, e))?; |
|
614 | 614 | let path = PyBytes::new(py, path.as_bytes()); |
General Comments 0
You need to be logged in to leave comments.
Login now