mirror of
https://github.com/facebook/sapling.git
synced 2024-10-05 14:28:17 +03:00
ignore file not found when creating a snapshot
Summary: Sometimes hg might recognise an untracked file as being added, but by the time it tries to load it, the file is gone, causing a crash. For snapshots, it should be fine in this case to simply ignore this file. That is what this diff does. It specifically ignores `FileNotFoundError`, meaning other files still get classified as errors and we're not swallowing anything we shouldn't be. Reviewed By: mitrandir77 Differential Revision: D34043083 fbshipit-source-id: cec7d528652c1704f3a3db707eafc0e43f24ac74
This commit is contained in:
parent
be5ddc9607
commit
3312f2c3cb
@ -103,6 +103,14 @@ pub async fn upload_snapshot(
|
||||
load_files(&root, rel_path.clone(), file_type, tracked)
|
||||
.with_context(|| anyhow::anyhow!("Failed to load file {}", rel_path))
|
||||
})
|
||||
// Let's ignore file not found errors, they might come from transient files that disappeared.
|
||||
.filter_map(|res| match res {
|
||||
Ok(ok) => Some(Ok(ok)),
|
||||
Err(err) => match err.downcast_ref::<std::io::Error>() {
|
||||
Some(io_error) if io_error.kind() == std::io::ErrorKind::NotFound => None,
|
||||
_ => Some(Err(err)),
|
||||
},
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?
|
||||
.into_iter()
|
||||
.unzip();
|
||||
|
Loading…
Reference in New Issue
Block a user