Show More
@@ -981,6 +981,7 b' dependencies = [' | |||
|
981 | 981 | "lazy_static", |
|
982 | 982 | "log", |
|
983 | 983 | "micro-timer", |
|
984 | "rayon", | |
|
984 | 985 | "regex", |
|
985 | 986 | "users", |
|
986 | 987 | "which", |
@@ -17,18 +17,21 b' pub struct Filelog {' | |||
|
17 | 17 | } |
|
18 | 18 | |
|
19 | 19 | impl Filelog { |
|
20 | pub fn open(repo: &Repo, file_path: &HgPath) -> Result<Self, HgError> { | |
|
20 | pub fn open_vfs( | |
|
21 | store_vfs: &crate::vfs::Vfs<'_>, | |
|
22 | file_path: &HgPath, | |
|
23 | ) -> Result<Self, HgError> { | |
|
21 | 24 | let index_path = store_path(file_path, b".i"); |
|
22 | 25 | let data_path = store_path(file_path, b".d"); |
|
23 |
let revlog = |
|
|
24 | &repo.store_vfs(), | |
|
25 | index_path, | |
|
26 | Some(&data_path), | |
|
27 | false, | |
|
28 | )?; | |
|
26 | let revlog = | |
|
27 | Revlog::open(store_vfs, index_path, Some(&data_path), false)?; | |
|
29 | 28 | Ok(Self { revlog }) |
|
30 | 29 | } |
|
31 | 30 | |
|
31 | pub fn open(repo: &Repo, file_path: &HgPath) -> Result<Self, HgError> { | |
|
32 | Self::open_vfs(&repo.store_vfs(), file_path) | |
|
33 | } | |
|
34 | ||
|
32 | 35 | /// The given node ID is that of the file as found in a filelog, not of a |
|
33 | 36 | /// changeset. |
|
34 | 37 | pub fn data_for_node( |
@@ -97,7 +97,7 b' pub(crate) fn parse_config(' | |||
|
97 | 97 | Includes, |
|
98 | 98 | Excludes, |
|
99 | 99 | None, |
|
100 |
} |
|
|
100 | } | |
|
101 | 101 | |
|
102 | 102 | let mut current = Current::None; |
|
103 | 103 | let mut in_section = false; |
@@ -22,3 +22,4 b' env_logger = "0.9.0"' | |||
|
22 | 22 | format-bytes = "0.3.0" |
|
23 | 23 | users = "0.11.0" |
|
24 | 24 | which = "4.2.5" |
|
25 | rayon = "1.5.1" |
@@ -29,6 +29,7 b' use hg::StatusError;' | |||
|
29 | 29 | use hg::StatusOptions; |
|
30 | 30 | use hg::{self, narrow, sparse}; |
|
31 | 31 | use log::info; |
|
32 | use rayon::prelude::*; | |
|
32 | 33 | use std::io; |
|
33 | 34 | use std::path::PathBuf; |
|
34 | 35 | |
@@ -291,16 +292,31 b' pub fn run(invocation: &crate::CliInvoca' | |||
|
291 | 292 | let manifest = repo.manifest_for_node(p1).map_err(|e| { |
|
292 | 293 | CommandError::from((e, &*format!("{:x}", p1.short()))) |
|
293 | 294 | })?; |
|
294 | for to_check in ds_status.unsure { | |
|
295 | if unsure_is_modified(repo, &manifest, &to_check.path)? { | |
|
295 | let working_directory_vfs = repo.working_directory_vfs(); | |
|
296 | let store_vfs = repo.store_vfs(); | |
|
297 | let res: Vec<_> = ds_status | |
|
298 | .unsure | |
|
299 | .into_par_iter() | |
|
300 | .map(|to_check| { | |
|
301 | unsure_is_modified( | |
|
302 | working_directory_vfs, | |
|
303 | store_vfs, | |
|
304 | &manifest, | |
|
305 | &to_check.path, | |
|
306 | ) | |
|
307 | .map(|modified| (to_check, modified)) | |
|
308 | }) | |
|
309 | .collect::<Result<_, _>>()?; | |
|
310 | for (status_path, is_modified) in res.into_iter() { | |
|
311 | if is_modified { | |
|
296 | 312 | if display_states.modified { |
|
297 |
ds_status.modified.push( |
|
|
313 | ds_status.modified.push(status_path); | |
|
298 | 314 | } |
|
299 | 315 | } else { |
|
300 | 316 | if display_states.clean { |
|
301 |
ds_status.clean.push( |
|
|
317 | ds_status.clean.push(status_path.clone()); | |
|
302 | 318 | } |
|
303 |
fixup.push( |
|
|
319 | fixup.push(status_path.path.into_owned()) | |
|
304 | 320 | } |
|
305 | 321 | } |
|
306 | 322 | } |
@@ -525,11 +541,12 b" impl DisplayStatusPaths<'_> {" | |||
|
525 | 541 | /// This meant to be used for those that the dirstate cannot resolve, due |
|
526 | 542 | /// to time resolution limits. |
|
527 | 543 | fn unsure_is_modified( |
|
528 | repo: &Repo, | |
|
544 | working_directory_vfs: hg::vfs::Vfs, | |
|
545 | store_vfs: hg::vfs::Vfs, | |
|
529 | 546 | manifest: &Manifest, |
|
530 | 547 | hg_path: &HgPath, |
|
531 | 548 | ) -> Result<bool, HgError> { |
|
532 |
let vfs = |
|
|
549 | let vfs = working_directory_vfs; | |
|
533 | 550 | let fs_path = hg_path_to_path_buf(hg_path).expect("HgPath conversion"); |
|
534 | 551 | let fs_metadata = vfs.symlink_metadata(&fs_path)?; |
|
535 | 552 | let is_symlink = fs_metadata.file_type().is_symlink(); |
@@ -549,7 +566,7 b' fn unsure_is_modified(' | |||
|
549 | 566 | if entry.flags != fs_flags { |
|
550 | 567 | return Ok(true); |
|
551 | 568 | } |
|
552 |
let filelog = |
|
|
569 | let filelog = hg::filelog::Filelog::open_vfs(&store_vfs, hg_path)?; | |
|
553 | 570 | let fs_len = fs_metadata.len(); |
|
554 | 571 | let file_node = entry.node_id()?; |
|
555 | 572 | let filelog_entry = filelog.entry_for_node(file_node).map_err(|_| { |
General Comments 0
You need to be logged in to leave comments.
Login now