diff rust/hg-core/src/vfs.rs @ 48345:d5a91701f7dc

rhg: Fix status desambiguation of symlinks and executable files Differential Revision: https://phab.mercurial-scm.org/D11774
author Simon Sapin <simon.sapin@octobus.net>
date Tue, 23 Nov 2021 20:04:22 +0100
parents 9d0e5629cfbf
children 5734b03ecf3e
line wrap: on
line diff
--- a/rust/hg-core/src/vfs.rs	Tue Nov 23 19:40:29 2021 +0100
+++ b/rust/hg-core/src/vfs.rs	Tue Nov 23 20:04:22 2021 +0100
@@ -16,6 +16,22 @@
         self.base.join(relative_path)
     }
 
+    pub fn symlink_metadata(
+        &self,
+        relative_path: impl AsRef<Path>,
+    ) -> Result<std::fs::Metadata, HgError> {
+        let path = self.join(relative_path);
+        std::fs::symlink_metadata(&path).when_reading_file(&path)
+    }
+
+    pub fn read_link(
+        &self,
+        relative_path: impl AsRef<Path>,
+    ) -> Result<PathBuf, HgError> {
+        let path = self.join(relative_path);
+        std::fs::read_link(&path).when_reading_file(&path)
+    }
+
     pub fn read(
         &self,
         relative_path: impl AsRef<Path>,