Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/upgrade_utils/actions.py @ 46055:72b7b4bf3e65
upgrade: extract the checking of target requirements change
This logic is fairly independant, lets move it out of the main function.
Differential Revision: https://phab.mercurial-scm.org/D9485
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 01 Dec 2020 20:24:38 +0100 |
parents | a2a59cde9b9f |
children | 08802795ae90 |
comparison
equal
deleted
inserted
replaced
46054:ad9dd4d333be | 46055:72b7b4bf3e65 |
---|---|
684 blockingreqs = blocking & repo.requirements | 684 blockingreqs = blocking & repo.requirements |
685 if blockingreqs: | 685 if blockingreqs: |
686 m = _(b'cannot upgrade repository; unsupported source requirement: %s') | 686 m = _(b'cannot upgrade repository; unsupported source requirement: %s') |
687 blockingreqs = b', '.join(sorted(blockingreqs)) | 687 blockingreqs = b', '.join(sorted(blockingreqs)) |
688 raise error.Abort(m % blockingreqs) | 688 raise error.Abort(m % blockingreqs) |
689 | |
690 | |
691 ### Verify the validity of the planned requirement changes #################### | |
692 | |
693 | |
694 def check_requirements_changes(repo, new_reqs): | |
695 old_reqs = repo.requirements | |
696 | |
697 support_removal = supportremovedrequirements(repo) | |
698 no_remove_reqs = old_reqs - new_reqs - support_removal | |
699 if no_remove_reqs: | |
700 msg = _(b'cannot upgrade repository; requirement would be removed: %s') | |
701 no_remove_reqs = b', '.join(sorted(no_remove_reqs)) | |
702 raise error.Abort(msg % no_remove_reqs) | |
703 | |
704 support_addition = allowednewrequirements(repo) | |
705 no_add_reqs = new_reqs - old_reqs - support_addition | |
706 if no_add_reqs: | |
707 m = _(b'cannot upgrade repository; do not support adding requirement: ') | |
708 no_add_reqs = b', '.join(sorted(no_add_reqs)) | |
709 raise error.Abort(m + no_add_reqs) | |
710 | |
711 supported = supporteddestrequirements(repo) | |
712 unsupported_reqs = new_reqs - supported | |
713 if unsupported_reqs: | |
714 msg = _( | |
715 b'cannot upgrade repository; do not support destination ' | |
716 b'requirement: %s' | |
717 ) | |
718 unsupported_reqs = b', '.join(sorted(unsupported_reqs)) | |
719 raise error.Abort(msg % unsupported_reqs) |