comparison mercurial/localrepo.py @ 46336:4f17773fc6b5

share: rename share-safe warning config Config introduced in previous patch was `share.source-safe-mismatch`. Let's rename the warn as `share.source-safe-mismatch.warn`. While we are here, made sure we have different configs for upgrade and downgrade. Differential Revision: https://phab.mercurial-scm.org/D9786
author Pulkit Goyal <7895pulkit@gmail.com>
date Fri, 15 Jan 2021 12:08:07 +0530
parents 25be21ec6c65
children 4b0192f592cf
comparison
equal deleted inserted replaced
46335:25be21ec6c65 46336:4f17773fc6b5
573 if ( 573 if (
574 shared 574 shared
575 and requirementsmod.SHARESAFE_REQUIREMENT 575 and requirementsmod.SHARESAFE_REQUIREMENT
576 not in _readrequires(sharedvfs, True) 576 not in _readrequires(sharedvfs, True)
577 ): 577 ):
578 mismatch_warn = ui.configbool(
579 b'share', b'safe-mismatch.source-not-safe.warn'
580 )
578 mismatch_config = ui.config( 581 mismatch_config = ui.config(
579 b'share', b'safe-mismatch.source-not-safe' 582 b'share', b'safe-mismatch.source-not-safe'
580 ) 583 )
581 if mismatch_config in ( 584 if mismatch_config in (
582 b'downgrade-allow', 585 b'downgrade-allow',
590 ui, 593 ui,
591 hgvfs, 594 hgvfs,
592 sharedvfs, 595 sharedvfs,
593 requirements, 596 requirements,
594 mismatch_config, 597 mismatch_config,
598 mismatch_warn,
595 ) 599 )
596 elif mismatch_config == b'abort': 600 elif mismatch_config == b'abort':
597 raise error.Abort( 601 raise error.Abort(
598 _( 602 _(
599 b"share source does not support exp-sharesafe requirement" 603 b"share source does not support exp-sharesafe requirement"
616 requirements |= _readrequires(storevfs, False) 620 requirements |= _readrequires(storevfs, False)
617 elif shared: 621 elif shared:
618 sourcerequires = _readrequires(sharedvfs, False) 622 sourcerequires = _readrequires(sharedvfs, False)
619 if requirementsmod.SHARESAFE_REQUIREMENT in sourcerequires: 623 if requirementsmod.SHARESAFE_REQUIREMENT in sourcerequires:
620 mismatch_config = ui.config(b'share', b'safe-mismatch.source-safe') 624 mismatch_config = ui.config(b'share', b'safe-mismatch.source-safe')
625 mismatch_warn = ui.configbool(
626 b'share', b'safe-mismatch.source-safe.warn'
627 )
621 if mismatch_config in ( 628 if mismatch_config in (
622 b'upgrade-allow', 629 b'upgrade-allow',
623 b'allow', 630 b'allow',
624 b'upgrade-abort', 631 b'upgrade-abort',
625 ): 632 ):
630 ui, 637 ui,
631 hgvfs, 638 hgvfs,
632 storevfs, 639 storevfs,
633 requirements, 640 requirements,
634 mismatch_config, 641 mismatch_config,
642 mismatch_warn,
635 ) 643 )
636 elif mismatch_config == b'abort': 644 elif mismatch_config == b'abort':
637 raise error.Abort( 645 raise error.Abort(
638 _( 646 _(
639 b'version mismatch: source uses share-safe' 647 b'version mismatch: source uses share-safe'