# HG changeset patch # User Arseniy Alekseyev <aalekseyev@janestreet.com> # Date 1722513878 -3600 # Thu Aug 01 13:04:38 2024 +0100 # Branch stable # Node ID 955084b4f74f2ffdb914016c5fae2a8d185da056 # Parent a431b41299fc443b3caf3b6206f1c4053c5da4c4 rhg: ignore readonly FS error when saving dirstate The error is already ignored when the .hg directory is read-only, so this is only fair. (the python hg is silent on readonly fs, too) diff --git a/rust/Cargo.lock b/rust/Cargo.lock --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -734,9 +734,9 @@ [[package]] name = "libc" -version = "0.2.137" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libm" @@ -1178,6 +1178,7 @@ "hg-core", "home", "lazy_static", + "libc", "log", "logging_timer", "rayon", diff --git a/rust/rhg/Cargo.toml b/rust/rhg/Cargo.toml --- a/rust/rhg/Cargo.toml +++ b/rust/rhg/Cargo.toml @@ -24,3 +24,4 @@ whoami = "1.4" which = "4.3.0" rayon = "1.7.0" +libc = "0.2.155" diff --git a/rust/rhg/src/commands/status.rs b/rust/rhg/src/commands/status.rs --- a/rust/rhg/src/commands/status.rs +++ b/rust/rhg/src/commands/status.rs @@ -611,7 +611,11 @@ log::info!("not writing dirstate from `status`: lock is held") } Err(LockError::Other(HgError::IoError { error, .. })) - if error.kind() == io::ErrorKind::PermissionDenied => + if error.kind() == io::ErrorKind::PermissionDenied + || match error.raw_os_error() { + None => false, + Some(errno) => libc::EROFS == errno, + } => { // `hg status` on a read-only repository is fine }