Mercurial > hg-stable
changeset 50274:0cc19a53cef4 stable
rust: fix building on macOS (issue6801)
The VFS change is copied over from Cargo, and likely to apply to other
platforms as well.
The dirstate change is essentially a replay of 440972d2175d, which was
reverted in e98fd81bb151, part of !383, to silence some clippy
warnings.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Tue, 07 Mar 2023 13:39:31 +0100 |
parents | 5069a89a936e |
children | ada9a0245fd7 |
files | rust/hg-core/src/dirstate_tree/on_disk.rs rust/hg-core/src/vfs.rs |
diffstat | 2 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate_tree/on_disk.rs Wed Mar 08 00:46:53 2023 +0100 +++ b/rust/hg-core/src/dirstate_tree/on_disk.rs Tue Mar 07 13:39:31 2023 +0100 @@ -415,9 +415,9 @@ fn synthesize_unix_mode(&self) -> u32 { let file_type = if self.flags().contains(Flags::MODE_IS_SYMLINK) { - libc::S_IFLNK + libc::S_IFLNK as u32 } else { - libc::S_IFREG + libc::S_IFREG as u32 }; let permissions = if self.flags().contains(Flags::MODE_EXEC_PERM) { 0o755
--- a/rust/hg-core/src/vfs.rs Wed Mar 08 00:46:53 2023 +0100 +++ b/rust/hg-core/src/vfs.rs Tue Mar 07 13:39:31 2023 +0100 @@ -193,3 +193,13 @@ r == 0 && buf.f_type as u32 == libc::NFS_SUPER_MAGIC as u32 } } + +/// Similar to what Cargo does; although detecting NFS (or non-local +/// file systems) _should_ be possible on other operating systems, +/// we'll just assume that mmap() works there, for now; after all, +/// _some_ functionality is better than a compile error, i.e. none at +/// all +#[cfg(not(target_os = "linux"))] +pub(crate) fn is_on_nfs_mount(_path: impl AsRef<Path>) -> bool { + false +}