##// END OF EJS Templates
upgrade: move requirements checking in a dedicated function...
marmoute -
r46663:f4f95634 default
parent child Browse files
Show More
@@ -72,26 +72,7 b' def upgraderepo('
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.
@@ -9,6 +9,7 b' from __future__ import absolute_import'
9
9
10 from ..i18n import _
10 from ..i18n import _
11 from .. import (
11 from .. import (
12 error,
12 localrepo,
13 localrepo,
13 requirements,
14 requirements,
14 util,
15 util,
@@ -664,3 +665,21 b' def determineactions(repo, deficiencies,'
664 # e.g. adding generaldelta could schedule parent redeltas.
665 # e.g. adding generaldelta could schedule parent redeltas.
665
666
666 return newactions
667 return newactions
668
669
670 def check_source_requirements(repo):
671 """Ensure that no existing requirements prevent the repository upgrade"""
672
673 required = requiredsourcerequirements(repo)
674 missingreqs = required - repo.requirements
675 if missingreqs:
676 msg = _(b'cannot upgrade repository; requirement missing: %s')
677 missingreqs = b', '.join(sorted(missingreqs))
678 raise error.Abort(msg % missingreqs)
679
680 blocking = blocksourcerequirements(repo)
681 blockingreqs = blocking & repo.requirements
682 if blockingreqs:
683 m = _(b'cannot upgrade repository; unsupported source requirement: %s')
684 blockingreqs = b', '.join(sorted(blockingreqs))
685 raise error.Abort(m % blockingreqs)
General Comments 0
You need to be logged in to leave comments. Login now