Mercurial > public > mercurial-scm > hg
comparison mercurial/upgrade.py @ 46048:f4f956342cf1
upgrade: move requirements checking in a dedicated function
This is a simple an isolated check that can go next to the associated code.
Differential Revision: https://phab.mercurial-scm.org/D9482
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 01 Dec 2020 15:45:23 +0100 |
parents | 4b89cf08d8dc |
children | ad9dd4d333be |
comparison
equal
deleted
inserted
replaced
46047:4b89cf08d8dc | 46048:f4f956342cf1 |
---|---|
70 # none are enabled | 70 # none are enabled |
71 for upgrade, __ in specified: | 71 for upgrade, __ in specified: |
72 revlogs.discard(upgrade) | 72 revlogs.discard(upgrade) |
73 | 73 |
74 # Ensure the repository can be upgraded. | 74 # Ensure the repository can be upgraded. |
75 missingreqs = ( | 75 upgrade_actions.check_source_requirements(repo) |
76 upgrade_actions.requiredsourcerequirements(repo) - repo.requirements | |
77 ) | |
78 if missingreqs: | |
79 raise error.Abort( | |
80 _(b'cannot upgrade repository; requirement missing: %s') | |
81 % _(b', ').join(sorted(missingreqs)) | |
82 ) | |
83 | |
84 blockedreqs = ( | |
85 upgrade_actions.blocksourcerequirements(repo) & repo.requirements | |
86 ) | |
87 if blockedreqs: | |
88 raise error.Abort( | |
89 _( | |
90 b'cannot upgrade repository; unsupported source ' | |
91 b'requirement: %s' | |
92 ) | |
93 % _(b', ').join(sorted(blockedreqs)) | |
94 ) | |
95 | 76 |
96 # FUTURE there is potentially a need to control the wanted requirements via | 77 # FUTURE there is potentially a need to control the wanted requirements via |
97 # command arguments or via an extension hook point. | 78 # command arguments or via an extension hook point. |
98 newreqs = localrepo.newreporequirements( | 79 newreqs = localrepo.newreporequirements( |
99 repo.ui, localrepo.defaultcreateopts(repo.ui) | 80 repo.ui, localrepo.defaultcreateopts(repo.ui) |