equal
deleted
inserted
replaced
8 //! A multiset of directory names. |
8 //! A multiset of directory names. |
9 //! |
9 //! |
10 //! Used to counts the references to directories in a manifest or dirstate. |
10 //! Used to counts the references to directories in a manifest or dirstate. |
11 use crate::dirstate_tree::on_disk::DirstateV2ParseError; |
11 use crate::dirstate_tree::on_disk::DirstateV2ParseError; |
12 use crate::{ |
12 use crate::{ |
13 dirstate::EntryState, |
|
14 utils::{ |
13 utils::{ |
15 files, |
14 files, |
16 hg_path::{HgPath, HgPathBuf, HgPathError}, |
15 hg_path::{HgPath, HgPathBuf, HgPathError}, |
17 }, |
16 }, |
18 DirstateEntry, DirstateError, DirstateMapError, FastHashMap, |
17 DirstateEntry, DirstateError, DirstateMapError, FastHashMap, |
47 for item in dirstate { |
46 for item in dirstate { |
48 let (filename, entry) = item?; |
47 let (filename, entry) = item?; |
49 let filename = filename.as_ref(); |
48 let filename = filename.as_ref(); |
50 // This `if` is optimized out of the loop |
49 // This `if` is optimized out of the loop |
51 if only_tracked { |
50 if only_tracked { |
52 if entry.state() != EntryState::Removed { |
51 if !entry.removed() { |
53 multiset.add_path(filename)?; |
52 multiset.add_path(filename)?; |
54 } |
53 } |
55 } else { |
54 } else { |
56 multiset.add_path(filename)?; |
55 multiset.add_path(filename)?; |
57 } |
56 } |
213 } |
212 } |
214 } |
213 } |
215 |
214 |
216 #[cfg(test)] |
215 #[cfg(test)] |
217 mod tests { |
216 mod tests { |
|
217 use crate::EntryState; |
|
218 |
218 use super::*; |
219 use super::*; |
219 |
220 |
220 #[test] |
221 #[test] |
221 fn test_delete_path_path_not_found() { |
222 fn test_delete_path_path_not_found() { |
222 let manifest: Vec<HgPathBuf> = vec![]; |
223 let manifest: Vec<HgPathBuf> = vec![]; |