… instead of its reexport in the crossbeam crate.
This removes two crates from the dependency graph.
marmoute | |
pulkit |
hg-reviewers |
… instead of its reexport in the crossbeam crate.
This removes two crates from the dependency graph.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | rust/Cargo.lock (27 lines) | |||
M | rust/hg-core/Cargo.toml (2 lines) | |||
M | rust/hg-core/src/dirstate/status.rs (20 lines) | |||
M | rust/hg-core/src/operations/dirstate_status.rs (4 lines) |
name = "crc32fast" | name = "crc32fast" | ||||
version = "1.2.0" | version = "1.2.0" | ||||
source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
dependencies = [ | dependencies = [ | ||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
] | ] | ||||
[[package]] | [[package]] | ||||
name = "crossbeam" | |||||
version = "0.7.3" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"crossbeam-channel 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"crossbeam-queue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "crossbeam-channel" | name = "crossbeam-channel" | ||||
version = "0.4.4" | version = "0.4.4" | ||||
source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
dependencies = [ | dependencies = [ | ||||
"crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", | "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
"maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
] | ] | ||||
"crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", | "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
"maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
"memoffset 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", | "memoffset 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
"scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
] | ] | ||||
[[package]] | [[package]] | ||||
name = "crossbeam-queue" | |||||
version = "0.2.3" | |||||
source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
dependencies = [ | |||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
"maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | |||||
] | |||||
[[package]] | |||||
name = "crossbeam-utils" | name = "crossbeam-utils" | ||||
version = "0.7.2" | version = "0.7.2" | ||||
source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
dependencies = [ | dependencies = [ | ||||
"autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", | "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
] | ] | ||||
source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
[[package]] | [[package]] | ||||
name = "hg-core" | name = "hg-core" | ||||
version = "0.1.0" | version = "0.1.0" | ||||
dependencies = [ | dependencies = [ | ||||
"byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", | "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
"clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", | "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
"crossbeam 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", | "crossbeam-channel 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
"flate2 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", | "flate2 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
"hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", | "hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
"im-rc 15.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | "im-rc 15.0.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
"log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", | "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
"memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
"memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", | "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
"micro-timer 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | "micro-timer 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||||
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" | "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" | ||||
"checksum bitmaps 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" | "checksum bitmaps 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" | ||||
"checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" | "checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" | ||||
"checksum cc 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)" = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c" | "checksum cc 1.0.60 (registry+https://github.com/rust-lang/crates.io-index)" = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c" | ||||
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" | "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" | ||||
"checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" | "checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" | ||||
"checksum cpython 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bfaf3847ab963e40c4f6dd8d6be279bdf74007ae2413786a0dcbb28c52139a95" | "checksum cpython 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bfaf3847ab963e40c4f6dd8d6be279bdf74007ae2413786a0dcbb28c52139a95" | ||||
"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" | "checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" | ||||
"checksum crossbeam 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "69323bff1fb41c635347b8ead484a5ca6c3f11914d784170b158d8449ab07f8e" | |||||
"checksum crossbeam-channel 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" | "checksum crossbeam-channel 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" | ||||
"checksum crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" | "checksum crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" | ||||
"checksum crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" | "checksum crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" | ||||
"checksum crossbeam-queue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" | |||||
"checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" | "checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" | ||||
"checksum ctor 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "7fbaabec2c953050352311293be5c6aba8e141ba19d6811862b232d6fd020484" | "checksum ctor 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "7fbaabec2c953050352311293be5c6aba8e141ba19d6811862b232d6fd020484" | ||||
"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" | "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" | ||||
"checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" | "checksum either 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" | ||||
"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" | "checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" | ||||
"checksum flate2 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "766d0e77a2c1502169d4a93ff3b8c15a71fd946cd0126309752104e5f3c46d94" | "checksum flate2 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)" = "766d0e77a2c1502169d4a93ff3b8c15a71fd946cd0126309752104e5f3c46d94" | ||||
"checksum format-bytes 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1a7374eb574cd29ae45878554298091c554c3286a17b3afa440a3e2710ae0790" | "checksum format-bytes 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1a7374eb574cd29ae45878554298091c554c3286a17b3afa440a3e2710ae0790" | ||||
"checksum format-bytes-macros 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4edcc04201cea17a0e6b937adebd46b93fba09924c7e6ed8c515a35ce8432cbc" | "checksum format-bytes-macros 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4edcc04201cea17a0e6b937adebd46b93fba09924c7e6ed8c515a35ce8432cbc" |
memchr = "2.3.3" | memchr = "2.3.3" | ||||
rand = "0.7.3" | rand = "0.7.3" | ||||
rand_pcg = "0.2.1" | rand_pcg = "0.2.1" | ||||
rand_distr = "0.2.2" | rand_distr = "0.2.2" | ||||
rayon = "1.3.0" | rayon = "1.3.0" | ||||
regex = "1.3.9" | regex = "1.3.9" | ||||
twox-hash = "1.5.0" | twox-hash = "1.5.0" | ||||
same-file = "1.0.6" | same-file = "1.0.6" | ||||
crossbeam = "0.7.3" | crossbeam-channel = "0.4" | ||||
micro-timer = "0.3.0" | micro-timer = "0.3.0" | ||||
log = "0.4.8" | log = "0.4.8" | ||||
memmap = "0.7.0" | memmap = "0.7.0" | ||||
zstd = "0.5.3" | zstd = "0.5.3" | ||||
rust-crypto = "0.2.36" | rust-crypto = "0.2.36" | ||||
# We don't use the `miniz-oxide` backend to not change rhg benchmarks and until | # We don't use the `miniz-oxide` backend to not change rhg benchmarks and until | ||||
# we have a clearer view of which backend is the fastest. | # we have a clearer view of which backend is the fastest. |
/// Get stat data about the files explicitly specified by the matcher. | /// Get stat data about the files explicitly specified by the matcher. | ||||
/// Returns a tuple of the directories that need to be traversed and the | /// Returns a tuple of the directories that need to be traversed and the | ||||
/// files with their corresponding `Dispatch`. | /// files with their corresponding `Dispatch`. | ||||
/// TODO subrepos | /// TODO subrepos | ||||
#[timed] | #[timed] | ||||
pub fn walk_explicit( | pub fn walk_explicit( | ||||
&self, | &self, | ||||
traversed_sender: crossbeam::Sender<HgPathBuf>, | traversed_sender: crossbeam_channel::Sender<HgPathBuf>, | ||||
) -> (Vec<DispatchedPath<'a>>, Vec<DispatchedPath<'a>>) { | ) -> (Vec<DispatchedPath<'a>>, Vec<DispatchedPath<'a>>) { | ||||
self.matcher | self.matcher | ||||
.file_set() | .file_set() | ||||
.unwrap_or(&DEFAULT_WORK) | .unwrap_or(&DEFAULT_WORK) | ||||
.par_iter() | .par_iter() | ||||
.flat_map(|&filename| -> Option<_> { | .flat_map(|&filename| -> Option<_> { | ||||
// TODO normalization | // TODO normalization | ||||
let normalized = filename; | let normalized = filename; | ||||
/// This takes a mutable reference to the results to account for the | /// This takes a mutable reference to the results to account for the | ||||
/// `extend` in timings | /// `extend` in timings | ||||
#[timed] | #[timed] | ||||
pub fn traverse( | pub fn traverse( | ||||
&self, | &self, | ||||
path: impl AsRef<HgPath>, | path: impl AsRef<HgPath>, | ||||
old_results: &FastHashMap<HgPathCow<'a>, Dispatch>, | old_results: &FastHashMap<HgPathCow<'a>, Dispatch>, | ||||
results: &mut Vec<DispatchedPath<'a>>, | results: &mut Vec<DispatchedPath<'a>>, | ||||
traversed_sender: crossbeam::Sender<HgPathBuf>, | traversed_sender: crossbeam_channel::Sender<HgPathBuf>, | ||||
) { | ) { | ||||
// The traversal is done in parallel, so use a channel to gather | // The traversal is done in parallel, so use a channel to gather | ||||
// entries. `crossbeam::Sender` is `Sync`, while `mpsc::Sender` | // entries. `crossbeam_channel::Sender` is `Sync`, while `mpsc::Sender` | ||||
// is not. | // is not. | ||||
let (files_transmitter, files_receiver) = | let (files_transmitter, files_receiver) = | ||||
crossbeam::channel::unbounded(); | crossbeam_channel::unbounded(); | ||||
self.traverse_dir( | self.traverse_dir( | ||||
&files_transmitter, | &files_transmitter, | ||||
path, | path, | ||||
&old_results, | &old_results, | ||||
traversed_sender, | traversed_sender, | ||||
); | ); | ||||
} | } | ||||
/// Dispatch a single entry (file, folder, symlink...) found during | /// Dispatch a single entry (file, folder, symlink...) found during | ||||
/// `traverse`. If the entry is a folder that needs to be traversed, it | /// `traverse`. If the entry is a folder that needs to be traversed, it | ||||
/// will be handled in a separate thread. | /// will be handled in a separate thread. | ||||
fn handle_traversed_entry<'b>( | fn handle_traversed_entry<'b>( | ||||
&'a self, | &'a self, | ||||
scope: &rayon::Scope<'b>, | scope: &rayon::Scope<'b>, | ||||
files_sender: &'b crossbeam::Sender<(HgPathBuf, Dispatch)>, | files_sender: &'b crossbeam_channel::Sender<(HgPathBuf, Dispatch)>, | ||||
old_results: &'a FastHashMap<Cow<HgPath>, Dispatch>, | old_results: &'a FastHashMap<Cow<HgPath>, Dispatch>, | ||||
filename: HgPathBuf, | filename: HgPathBuf, | ||||
dir_entry: DirEntry, | dir_entry: DirEntry, | ||||
traversed_sender: crossbeam::Sender<HgPathBuf>, | traversed_sender: crossbeam_channel::Sender<HgPathBuf>, | ||||
) -> IoResult<()> | ) -> IoResult<()> | ||||
where | where | ||||
'a: 'b, | 'a: 'b, | ||||
{ | { | ||||
let file_type = dir_entry.file_type()?; | let file_type = dir_entry.file_type()?; | ||||
let entry_option = self.dmap.get(&filename); | let entry_option = self.dmap.get(&filename); | ||||
if filename.as_bytes() == b".hg" { | if filename.as_bytes() == b".hg" { | ||||
Ok(()) | Ok(()) | ||||
} | } | ||||
/// A directory was found in the filesystem and needs to be traversed | /// A directory was found in the filesystem and needs to be traversed | ||||
fn handle_traversed_dir<'b>( | fn handle_traversed_dir<'b>( | ||||
&'a self, | &'a self, | ||||
scope: &rayon::Scope<'b>, | scope: &rayon::Scope<'b>, | ||||
files_sender: &'b crossbeam::Sender<(HgPathBuf, Dispatch)>, | files_sender: &'b crossbeam_channel::Sender<(HgPathBuf, Dispatch)>, | ||||
old_results: &'a FastHashMap<Cow<HgPath>, Dispatch>, | old_results: &'a FastHashMap<Cow<HgPath>, Dispatch>, | ||||
entry_option: Option<&'a DirstateEntry>, | entry_option: Option<&'a DirstateEntry>, | ||||
directory: HgPathBuf, | directory: HgPathBuf, | ||||
traversed_sender: crossbeam::Sender<HgPathBuf>, | traversed_sender: crossbeam_channel::Sender<HgPathBuf>, | ||||
) where | ) where | ||||
'a: 'b, | 'a: 'b, | ||||
{ | { | ||||
scope.spawn(move |_| { | scope.spawn(move |_| { | ||||
// Nested `if` until `rust-lang/rust#53668` is stable | // Nested `if` until `rust-lang/rust#53668` is stable | ||||
if let Some(entry) = entry_option { | if let Some(entry) = entry_option { | ||||
// Used to be a file, is now a folder | // Used to be a file, is now a folder | ||||
if self.matcher.matches_everything() | if self.matcher.matches_everything() | ||||
} | } | ||||
}); | }); | ||||
} | } | ||||
/// Decides whether the directory needs to be listed, and if so handles the | /// Decides whether the directory needs to be listed, and if so handles the | ||||
/// entries in a separate thread. | /// entries in a separate thread. | ||||
fn traverse_dir( | fn traverse_dir( | ||||
&self, | &self, | ||||
files_sender: &crossbeam::Sender<(HgPathBuf, Dispatch)>, | files_sender: &crossbeam_channel::Sender<(HgPathBuf, Dispatch)>, | ||||
directory: impl AsRef<HgPath>, | directory: impl AsRef<HgPath>, | ||||
old_results: &FastHashMap<Cow<HgPath>, Dispatch>, | old_results: &FastHashMap<Cow<HgPath>, Dispatch>, | ||||
traversed_sender: crossbeam::Sender<HgPathBuf>, | traversed_sender: crossbeam_channel::Sender<HgPathBuf>, | ||||
) { | ) { | ||||
let directory = directory.as_ref(); | let directory = directory.as_ref(); | ||||
if self.options.collect_traversed_dirs { | if self.options.collect_traversed_dirs { | ||||
traversed_sender | traversed_sender | ||||
.send(directory.to_owned()) | .send(directory.to_owned()) | ||||
.expect("receiver should outlive sender"); | .expect("receiver should outlive sender"); | ||||
} | } |
/// ambiguous whether they've changed, and the rest of the already dispatched | /// ambiguous whether they've changed, and the rest of the already dispatched | ||||
/// files. | /// files. | ||||
pub type LookupAndStatus<'a> = (Vec<HgPathCow<'a>>, DirstateStatus<'a>); | pub type LookupAndStatus<'a> = (Vec<HgPathCow<'a>>, DirstateStatus<'a>); | ||||
#[cfg(feature = "dirstate-tree")] | #[cfg(feature = "dirstate-tree")] | ||||
impl<'a, M: Matcher + Sync> Status<'a, M> { | impl<'a, M: Matcher + Sync> Status<'a, M> { | ||||
pub(crate) fn run(&self) -> Result<LookupAndStatus<'a>, StatusError> { | pub(crate) fn run(&self) -> Result<LookupAndStatus<'a>, StatusError> { | ||||
let (traversed_sender, traversed_receiver) = | let (traversed_sender, traversed_receiver) = | ||||
crossbeam::channel::unbounded(); | crossbeam_channel::unbounded(); | ||||
// Step 1: check the files explicitly mentioned by the user | // Step 1: check the files explicitly mentioned by the user | ||||
let (work, mut results) = self.walk_explicit(traversed_sender.clone()); | let (work, mut results) = self.walk_explicit(traversed_sender.clone()); | ||||
// Step 2: Check files in the dirstate | // Step 2: Check files in the dirstate | ||||
if !self.matcher.is_exact() { | if !self.matcher.is_exact() { | ||||
self.extend_from_dmap(&mut results); | self.extend_from_dmap(&mut results); | ||||
} | } | ||||
Ok(build_response(results, traversed)) | Ok(build_response(results, traversed)) | ||||
} | } | ||||
} | } | ||||
#[cfg(not(feature = "dirstate-tree"))] | #[cfg(not(feature = "dirstate-tree"))] | ||||
impl<'a, M: Matcher + Sync> Status<'a, M> { | impl<'a, M: Matcher + Sync> Status<'a, M> { | ||||
pub(crate) fn run(&self) -> Result<LookupAndStatus<'a>, StatusError> { | pub(crate) fn run(&self) -> Result<LookupAndStatus<'a>, StatusError> { | ||||
let (traversed_sender, traversed_receiver) = | let (traversed_sender, traversed_receiver) = | ||||
crossbeam::channel::unbounded(); | crossbeam_channel::unbounded(); | ||||
// Step 1: check the files explicitly mentioned by the user | // Step 1: check the files explicitly mentioned by the user | ||||
let (work, mut results) = self.walk_explicit(traversed_sender.clone()); | let (work, mut results) = self.walk_explicit(traversed_sender.clone()); | ||||
if !work.is_empty() { | if !work.is_empty() { | ||||
// Hashmaps are quite a bit slower to build than vecs, so only | // Hashmaps are quite a bit slower to build than vecs, so only | ||||
// build it if needed. | // build it if needed. | ||||
let old_results = results.iter().cloned().collect(); | let old_results = results.iter().cloned().collect(); |