equal
deleted
inserted
replaced
13 build_single_regex, filter_subincludes, get_patterns_from_file, |
13 build_single_regex, filter_subincludes, get_patterns_from_file, |
14 PatternFileWarning, PatternResult, |
14 PatternFileWarning, PatternResult, |
15 }, |
15 }, |
16 utils::{ |
16 utils::{ |
17 files::find_dirs, |
17 files::find_dirs, |
18 hg_path::{HgPath, HgPathBuf}, |
18 hg_path::{HgPath, HgPathBuf, HgPathError}, |
19 Escaped, |
19 Escaped, |
20 }, |
20 }, |
21 DirsMultiset, DirstateMapError, FastHashMap, IgnorePattern, PatternError, |
21 DirsMultiset, FastHashMap, IgnorePattern, PatternError, PatternSyntax, |
22 PatternSyntax, |
|
23 }; |
22 }; |
24 |
23 |
25 use crate::dirstate::status::IgnoreFnType; |
24 use crate::dirstate::status::IgnoreFnType; |
26 use crate::filepatterns::normalize_path_bytes; |
25 use crate::filepatterns::normalize_path_bytes; |
27 use std::borrow::ToOwned; |
26 use std::borrow::ToOwned; |
175 files: HashSet<HgPathBuf>, |
174 files: HashSet<HgPathBuf>, |
176 dirs: DirsMultiset, |
175 dirs: DirsMultiset, |
177 } |
176 } |
178 |
177 |
179 impl FileMatcher { |
178 impl FileMatcher { |
180 pub fn new(files: Vec<HgPathBuf>) -> Result<Self, DirstateMapError> { |
179 pub fn new(files: Vec<HgPathBuf>) -> Result<Self, HgPathError> { |
181 let dirs = DirsMultiset::from_manifest(&files)?; |
180 let dirs = DirsMultiset::from_manifest(&files)?; |
182 Ok(Self { |
181 Ok(Self { |
183 files: HashSet::from_iter(files.into_iter()), |
182 files: HashSet::from_iter(files.into_iter()), |
184 dirs, |
183 dirs, |
185 }) |
184 }) |
758 let (roots, dirs) = roots_and_dirs(ignore_patterns); |
757 let (roots, dirs) = roots_and_dirs(ignore_patterns); |
759 |
758 |
760 let mut parents = HashSet::new(); |
759 let mut parents = HashSet::new(); |
761 |
760 |
762 parents.extend( |
761 parents.extend( |
763 DirsMultiset::from_manifest(&dirs) |
762 DirsMultiset::from_manifest(&dirs)? |
764 .map_err(|e| match e { |
|
765 DirstateMapError::InvalidPath(e) => e, |
|
766 _ => unreachable!(), |
|
767 })? |
|
768 .iter() |
763 .iter() |
769 .map(ToOwned::to_owned), |
764 .map(ToOwned::to_owned), |
770 ); |
765 ); |
771 parents.extend( |
766 parents.extend( |
772 DirsMultiset::from_manifest(&roots) |
767 DirsMultiset::from_manifest(&roots)? |
773 .map_err(|e| match e { |
|
774 DirstateMapError::InvalidPath(e) => e, |
|
775 _ => unreachable!(), |
|
776 })? |
|
777 .iter() |
768 .iter() |
778 .map(ToOwned::to_owned), |
769 .map(ToOwned::to_owned), |
779 ); |
770 ); |
780 |
771 |
781 Ok(RootsDirsAndParents { |
772 Ok(RootsDirsAndParents { |