##// END OF EJS Templates
hg-core: remove unneeded util now that we support Rust 1.42+
Raphaël Gomès -
r50527:048f829a default
parent child Browse files
Show More
@@ -3,7 +3,6 b' use bytes_cast::{unaligned, BytesCast};'
3 use memmap2::Mmap;
3 use memmap2::Mmap;
4 use std::path::{Path, PathBuf};
4 use std::path::{Path, PathBuf};
5
5
6 use crate::utils::strip_suffix;
7 use crate::vfs::Vfs;
6 use crate::vfs::Vfs;
8
7
9 const ONDISK_VERSION: u8 = 1;
8 const ONDISK_VERSION: u8 = 1;
@@ -97,8 +96,9 b' fn rawdata_path(docket_path: &Path, uid:'
97 .expect("expected a base name")
96 .expect("expected a base name")
98 .to_str()
97 .to_str()
99 .expect("expected an ASCII file name in the store");
98 .expect("expected an ASCII file name in the store");
100 let prefix = strip_suffix(docket_name, ".n.a")
99 let prefix = docket_name
101 .or_else(|| strip_suffix(docket_name, ".n"))
100 .strip_suffix(".n.a")
101 .or_else(|| docket_name.strip_suffix(".n"))
102 .expect("expected docket path in .n or .n.a");
102 .expect("expected docket path in .n or .n.a");
103 let name = format!("{}-{}.nd", prefix, uid);
103 let name = format!("{}-{}.nd", prefix, uid);
104 docket_path
104 docket_path
@@ -196,15 +196,6 b" impl<'a> Escaped for &'a HgPath {"
196 }
196 }
197 }
197 }
198
198
199 // TODO: use the str method when we require Rust 1.45
200 pub(crate) fn strip_suffix<'a>(s: &'a str, suffix: &str) -> Option<&'a str> {
201 if s.ends_with(suffix) {
202 Some(&s[..s.len() - suffix.len()])
203 } else {
204 None
205 }
206 }
207
208 #[cfg(unix)]
199 #[cfg(unix)]
209 pub fn shell_quote(value: &[u8]) -> Vec<u8> {
200 pub fn shell_quote(value: &[u8]) -> Vec<u8> {
210 // TODO: Use the `matches!` macro when we require Rust 1.42+
201 // TODO: Use the `matches!` macro when we require Rust 1.42+
General Comments 0
You need to be logged in to leave comments. Login now