changeset 51670:955084b4f74f stable

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)
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Thu, 01 Aug 2024 13:04:38 +0100
parents a431b41299fc
children 7d9bd50afe3d
files rust/Cargo.lock rust/rhg/Cargo.toml rust/rhg/src/commands/status.rs
diffstat 3 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rust/Cargo.lock	Thu Aug 01 16:34:37 2024 +0200
+++ b/rust/Cargo.lock	Thu Aug 01 13:04:38 2024 +0100
@@ -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",
--- a/rust/rhg/Cargo.toml	Thu Aug 01 16:34:37 2024 +0200
+++ b/rust/rhg/Cargo.toml	Thu Aug 01 13:04:38 2024 +0100
@@ -24,3 +24,4 @@
 whoami = "1.4"
 which = "4.3.0"
 rayon = "1.7.0"
+libc = "0.2.155"
--- a/rust/rhg/src/commands/status.rs	Thu Aug 01 16:34:37 2024 +0200
+++ b/rust/rhg/src/commands/status.rs	Thu Aug 01 13:04:38 2024 +0100
@@ -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
         }