comparison mercurial/localrepo.py @ 46236:eec47efe219d

sharesafe: add functionality to automatically downgrade shares Reasoning is same as previous patch which adds automatic upgrade support. Downgrade is required as if automatic upgrade is enabled, all shares upgrade and then source repository downgrades, shares won't work. We need to downgrade them. Differential Revision: https://phab.mercurial-scm.org/D9680
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 06 Jan 2021 18:31:16 +0530
parents 0babe12ef35d
children 9796cf108e4e
comparison
equal deleted inserted replaced
46235:0babe12ef35d 46236:eec47efe219d
572 if ( 572 if (
573 shared 573 shared
574 and requirementsmod.SHARESAFE_REQUIREMENT 574 and requirementsmod.SHARESAFE_REQUIREMENT
575 not in _readrequires(sharedvfs, True) 575 not in _readrequires(sharedvfs, True)
576 ): 576 ):
577 raise error.Abort( 577 if ui.configbool(
578 _(b"share source does not support exp-sharesafe requirement") 578 b'experimental', b'sharesafe-auto-downgrade-shares'
579 ) 579 ):
580 580 # prevent cyclic import localrepo -> upgrade -> localrepo
581 requirements |= _readrequires(storevfs, False) 581 from . import upgrade
582
583 upgrade.downgrade_share_to_non_safe(
584 ui,
585 hgvfs,
586 sharedvfs,
587 requirements,
588 )
589 else:
590 raise error.Abort(
591 _(
592 b"share source does not support exp-sharesafe requirement"
593 )
594 )
595 else:
596 requirements |= _readrequires(storevfs, False)
582 elif shared: 597 elif shared:
583 sourcerequires = _readrequires(sharedvfs, False) 598 sourcerequires = _readrequires(sharedvfs, False)
584 if requirementsmod.SHARESAFE_REQUIREMENT in sourcerequires: 599 if requirementsmod.SHARESAFE_REQUIREMENT in sourcerequires:
585 if ui.configbool(b'experimental', b'sharesafe-auto-upgrade-shares'): 600 if ui.configbool(b'experimental', b'sharesafe-auto-upgrade-shares'):
586 # prevent cyclic import localrepo -> upgrade -> localrepo 601 # prevent cyclic import localrepo -> upgrade -> localrepo