Patchwork D12213: rhg: simplify the handling of share-safe config mismatch

login
register
mail settings
Submitter phabricator
Date Feb. 21, 2022, 7:55 p.m.
Message ID <differential-rev-PHID-DREV-6je3dqkntbsq2pdqytoc-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50553/
State New
Headers show

Comments

phabricator - Feb. 21, 2022, 7:55 p.m.
aalekseyev created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12213

AFFECTED FILES
  rust/hg-core/src/repo.rs

CHANGE DETAILS




To: aalekseyev, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/hg-core/src/repo.rs b/rust/hg-core/src/repo.rs
--- a/rust/hg-core/src/repo.rs
+++ b/rust/hg-core/src/repo.rs
@@ -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 {