diff rust/hg-core/src/utils/files.rs @ 47113:be579775c2d9

dirstate-tree: Add the new `status()` algorithm With the dirstate organized in a tree that mirrors the structure of the filesystem tree, we can traverse both trees at the same time in order to compare them. This is hopefully more efficient that building multiple big hashmaps for all of the repository’s contents. Differential Revision: https://phab.mercurial-scm.org/D10547
author Simon Sapin <simon.sapin@octobus.net>
date Fri, 16 Apr 2021 12:12:41 +0200
parents c94fa884240b
children 789475ef2b22
line wrap: on
line diff
--- a/rust/hg-core/src/utils/files.rs	Fri Apr 16 12:12:04 2021 +0200
+++ b/rust/hg-core/src/utils/files.rs	Fri Apr 16 12:12:41 2021 +0200
@@ -17,7 +17,7 @@
 use lazy_static::lazy_static;
 use same_file::is_same_file;
 use std::borrow::{Cow, ToOwned};
-use std::ffi::OsStr;
+use std::ffi::{OsStr, OsString};
 use std::fs::Metadata;
 use std::iter::FusedIterator;
 use std::ops::Deref;
@@ -53,6 +53,12 @@
     str.as_ref().as_bytes().to_vec()
 }
 
+#[cfg(unix)]
+pub fn get_bytes_from_os_string(str: OsString) -> Vec<u8> {
+    use std::os::unix::ffi::OsStringExt;
+    str.into_vec()
+}
+
 /// An iterator over repository path yielding itself and its ancestors.
 #[derive(Copy, Clone, Debug)]
 pub struct Ancestors<'a> {