Mercurial > hg
diff rust/hg-core/src/dirstate/status.rs @ 47110:9c6b458a08e1
rust: Move "lookup" a.k.a. "unsure" paths into `DirstateStatus` struct
Instead of having `status()` returning a tuple of those paths and
`DirstateStatus`.
Differential Revision: https://phab.mercurial-scm.org/D10494
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Tue, 06 Apr 2021 15:14:19 +0200 |
parents | 787ff5d21bcd |
children | 623c8e4ddc6d |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate/status.rs Tue Apr 13 17:02:58 2021 +0200 +++ b/rust/hg-core/src/dirstate/status.rs Tue Apr 06 15:14:19 2021 +0200 @@ -264,6 +264,10 @@ pub ignored: Vec<HgPathCow<'a>>, pub unknown: Vec<HgPathCow<'a>>, pub bad: Vec<(HgPathCow<'a>, BadMatch)>, + /// Either clean or modified, but we can’t tell from filesystem metadata + /// alone. The file contents need to be read and compared with that in + /// the parent. + pub unsure: Vec<HgPathCow<'a>>, /// Only filled if `collect_traversed_dirs` is `true` pub traversed: Vec<HgPathBuf>, } @@ -847,8 +851,8 @@ pub fn build_response<'a>( results: impl IntoIterator<Item = DispatchedPath<'a>>, traversed: Vec<HgPathBuf>, -) -> (Vec<HgPathCow<'a>>, DirstateStatus<'a>) { - let mut lookup = vec![]; +) -> DirstateStatus<'a> { + let mut unsure = vec![]; let mut modified = vec![]; let mut added = vec![]; let mut removed = vec![]; @@ -861,7 +865,7 @@ for (filename, dispatch) in results.into_iter() { match dispatch { Dispatch::Unknown => unknown.push(filename), - Dispatch::Unsure => lookup.push(filename), + Dispatch::Unsure => unsure.push(filename), Dispatch::Modified => modified.push(filename), Dispatch::Added => added.push(filename), Dispatch::Removed => removed.push(filename), @@ -874,20 +878,18 @@ } } - ( - lookup, - DirstateStatus { - modified, - added, - removed, - deleted, - clean, - ignored, - unknown, - bad, - traversed, - }, - ) + DirstateStatus { + modified, + added, + removed, + deleted, + clean, + ignored, + unknown, + bad, + unsure, + traversed, + } } /// Get the status of files in the working directory. @@ -902,10 +904,7 @@ root_dir: PathBuf, ignore_files: Vec<PathBuf>, options: StatusOptions, -) -> StatusResult<( - (Vec<HgPathCow<'a>>, DirstateStatus<'a>), - Vec<PatternFileWarning>, -)> { +) -> StatusResult<(DirstateStatus<'a>, Vec<PatternFileWarning>)> { let (status, warnings) = Status::new(dmap, matcher, root_dir, ignore_files, options)?;