[Updated] D10803: rhg: Remove some intermediate Vecs in `rhg files`
SimonSapin
phabricator at mercurial-scm.org
Mon Jun 7 07:44:18 UTC 2021
Closed by commit rHGd2fb8b4adcc3: rhg: Remove some intermediate Vecs in `rhg files` (authored by SimonSapin).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D10803?vs=28314&id=28461
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D10803/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D10803
AFFECTED FILES
rust/hg-core/src/operations/list_tracked_files.rs
CHANGE DETAILS
diff --git a/rust/hg-core/src/operations/list_tracked_files.rs b/rust/hg-core/src/operations/list_tracked_files.rs
--- a/rust/hg-core/src/operations/list_tracked_files.rs
+++ b/rust/hg-core/src/operations/list_tracked_files.rs
@@ -5,7 +5,7 @@
// This software may be used and distributed according to the terms of the
// GNU General Public License version 2 or any later version.
-use crate::dirstate::parsers::parse_dirstate;
+use crate::dirstate::parsers::parse_dirstate_entries;
use crate::errors::HgError;
use crate::repo::Repo;
use crate::revlog::changelog::Changelog;
@@ -13,7 +13,6 @@
use crate::revlog::node::Node;
use crate::revlog::revlog::RevlogError;
use crate::utils::hg_path::HgPath;
-use crate::EntryState;
use rayon::prelude::*;
/// List files under Mercurial control in the working directory
@@ -30,14 +29,16 @@
}
pub fn tracked_files(&self) -> Result<Vec<&HgPath>, HgError> {
- let (_, entries, _) = parse_dirstate(&self.content)?;
- let mut files: Vec<&HgPath> = entries
- .into_iter()
- .filter_map(|(path, entry)| match entry.state {
- EntryState::Removed => None,
- _ => Some(path),
- })
- .collect();
+ let mut files = Vec::new();
+ let _parents = parse_dirstate_entries(
+ &self.content,
+ |path, entry, _copy_source| {
+ if entry.state.is_tracked() {
+ files.push(path)
+ }
+ Ok(())
+ },
+ )?;
files.par_sort_unstable();
Ok(files)
}
To: SimonSapin, #hg-reviewers, Alphare, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210607/012aad65/attachment-0002.html>
More information about the Mercurial-patches
mailing list