changeset 48809:1d5fd9def5ac

rhg: simplify the handling of share-safe config mismatch Differential Revision: https://phab.mercurial-scm.org/D12213
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Mon, 21 Feb 2022 19:51:23 +0000
parents db023e33b652
children ed03fffaac30
files rust/hg-core/src/repo.rs
diffstat 1 files changed, 2 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/repo.rs	Tue Mar 01 16:44:59 2022 +0100
+++ b/rust/hg-core/src/repo.rs	Mon Feb 21 19:51:23 2022 +0000
@@ -6,7 +6,6 @@
 use crate::dirstate_tree::owning::OwningDirstateMap;
 use crate::errors::HgResultExt;
 use crate::errors::{HgError, IoResultExt};
-use crate::exit_codes;
 use crate::lock::{try_with_lock_no_wait, LockError};
 use crate::manifest::{Manifest, Manifestlog};
 use crate::revlog::filelog::Filelog;
@@ -160,31 +159,8 @@
                 requirements::load(Vfs { base: &shared_path })?
                     .contains(requirements::SHARESAFE_REQUIREMENT);
 
-            if share_safe && !source_is_share_safe {
-                return Err(match config
-                    .get(b"share", b"safe-mismatch.source-not-safe")
-                {
-                    Some(b"abort") | None => HgError::abort(
-                        "abort: share source does not support share-safe requirement\n\
-                        (see `hg help config.format.use-share-safe` for more information)",
-                        exit_codes::ABORT,
-                    ),
-                    _ => HgError::unsupported("share-safe downgrade"),
-                }
-                .into());
-            } else if source_is_share_safe && !share_safe {
-                return Err(
-                    match config.get(b"share", b"safe-mismatch.source-safe") {
-                        Some(b"abort") | None => HgError::abort(
-                            "abort: version mismatch: source uses share-safe \
-                            functionality while the current share does not\n\
-                            (see `hg help config.format.use-share-safe` for more information)",
-                        exit_codes::ABORT,
-                        ),
-                        _ => HgError::unsupported("share-safe upgrade"),
-                    }
-                    .into(),
-                );
+            if share_safe != source_is_share_safe {
+                return Err(HgError::unsupported("share-safe mismatch").into());
             }
 
             if share_safe {