comparison rust/hg-core/src/repo.rs @ 46669:e8cd519a0a34

rhg: Ignore trailing newlines in .hg/sharedpath Differential Revision: https://phab.mercurial-scm.org/D10132
author Simon Sapin <simon.sapin@octobus.net>
date Thu, 04 Mar 2021 13:26:53 +0100
parents f64b6953db70
children 562a676e255a
comparison
equal deleted inserted replaced
46668:fb2368598281 46669:e8cd519a0a34
1 use crate::config::{Config, ConfigError, ConfigParseError}; 1 use crate::config::{Config, ConfigError, ConfigParseError};
2 use crate::errors::{HgError, IoErrorContext, IoResultExt}; 2 use crate::errors::{HgError, IoErrorContext, IoResultExt};
3 use crate::requirements; 3 use crate::requirements;
4 use crate::utils::current_dir;
5 use crate::utils::files::get_path_from_bytes; 4 use crate::utils::files::get_path_from_bytes;
5 use crate::utils::{current_dir, SliceExt};
6 use memmap::{Mmap, MmapOptions}; 6 use memmap::{Mmap, MmapOptions};
7 use std::collections::HashSet; 7 use std::collections::HashSet;
8 use std::path::{Path, PathBuf}; 8 use std::path::{Path, PathBuf};
9 9
10 /// A repository on disk 10 /// A repository on disk
116 let store_path; 116 let store_path;
117 if !shared { 117 if !shared {
118 store_path = dot_hg.join("store"); 118 store_path = dot_hg.join("store");
119 } else { 119 } else {
120 let bytes = hg_vfs.read("sharedpath")?; 120 let bytes = hg_vfs.read("sharedpath")?;
121 let mut shared_path = get_path_from_bytes(&bytes).to_owned(); 121 let mut shared_path =
122 get_path_from_bytes(bytes.trim_end_newlines()).to_owned();
122 if relative { 123 if relative {
123 shared_path = dot_hg.join(shared_path) 124 shared_path = dot_hg.join(shared_path)
124 } 125 }
125 if !shared_path.is_dir() { 126 if !shared_path.is_dir() {
126 return Err(HgError::corrupted(format!( 127 return Err(HgError::corrupted(format!(