4 use crate::dirstate_tree::dirstate_map::DirstateMap; |
4 use crate::dirstate_tree::dirstate_map::DirstateMap; |
5 use crate::dirstate_tree::on_disk::Docket as DirstateDocket; |
5 use crate::dirstate_tree::on_disk::Docket as DirstateDocket; |
6 use crate::dirstate_tree::owning::OwningDirstateMap; |
6 use crate::dirstate_tree::owning::OwningDirstateMap; |
7 use crate::errors::HgResultExt; |
7 use crate::errors::HgResultExt; |
8 use crate::errors::{HgError, IoResultExt}; |
8 use crate::errors::{HgError, IoResultExt}; |
9 use crate::exit_codes; |
|
10 use crate::lock::{try_with_lock_no_wait, LockError}; |
9 use crate::lock::{try_with_lock_no_wait, LockError}; |
11 use crate::manifest::{Manifest, Manifestlog}; |
10 use crate::manifest::{Manifest, Manifestlog}; |
12 use crate::revlog::filelog::Filelog; |
11 use crate::revlog::filelog::Filelog; |
13 use crate::revlog::revlog::RevlogError; |
12 use crate::revlog::revlog::RevlogError; |
14 use crate::utils::files::get_path_from_bytes; |
13 use crate::utils::files::get_path_from_bytes; |
158 |
157 |
159 let source_is_share_safe = |
158 let source_is_share_safe = |
160 requirements::load(Vfs { base: &shared_path })? |
159 requirements::load(Vfs { base: &shared_path })? |
161 .contains(requirements::SHARESAFE_REQUIREMENT); |
160 .contains(requirements::SHARESAFE_REQUIREMENT); |
162 |
161 |
163 if share_safe && !source_is_share_safe { |
162 if share_safe != source_is_share_safe { |
164 return Err(match config |
163 return Err(HgError::unsupported("share-safe mismatch").into()); |
165 .get(b"share", b"safe-mismatch.source-not-safe") |
|
166 { |
|
167 Some(b"abort") | None => HgError::abort( |
|
168 "abort: share source does not support share-safe requirement\n\ |
|
169 (see `hg help config.format.use-share-safe` for more information)", |
|
170 exit_codes::ABORT, |
|
171 ), |
|
172 _ => HgError::unsupported("share-safe downgrade"), |
|
173 } |
|
174 .into()); |
|
175 } else if source_is_share_safe && !share_safe { |
|
176 return Err( |
|
177 match config.get(b"share", b"safe-mismatch.source-safe") { |
|
178 Some(b"abort") | None => HgError::abort( |
|
179 "abort: version mismatch: source uses share-safe \ |
|
180 functionality while the current share does not\n\ |
|
181 (see `hg help config.format.use-share-safe` for more information)", |
|
182 exit_codes::ABORT, |
|
183 ), |
|
184 _ => HgError::unsupported("share-safe upgrade"), |
|
185 } |
|
186 .into(), |
|
187 ); |
|
188 } |
164 } |
189 |
165 |
190 if share_safe { |
166 if share_safe { |
191 repo_config_files.insert(0, shared_path.join("hgrc")) |
167 repo_config_files.insert(0, shared_path.join("hgrc")) |
192 } |
168 } |