Show More
@@ -87,6 +87,7 b' def upgraderepo(' | |||
|
87 | 87 | up_actions = upgrade_actions.determine_upgrade_actions( |
|
88 | 88 | repo, format_upgrades, optimizations, repo.requirements, newreqs |
|
89 | 89 | ) |
|
90 | removed_actions = upgrade_actions.find_format_downgrades(repo) | |
|
90 | 91 | |
|
91 | 92 | removedreqs = repo.requirements - newreqs |
|
92 | 93 | addedreqs = newreqs - repo.requirements |
@@ -108,6 +109,7 b' def upgraderepo(' | |||
|
108 | 109 | newreqs, |
|
109 | 110 | repo.requirements, |
|
110 | 111 | up_actions, |
|
112 | removed_actions, | |
|
111 | 113 | revlogs, |
|
112 | 114 | ) |
|
113 | 115 | |
@@ -226,20 +228,4 b' def upgraderepo(' | |||
|
226 | 228 | ) |
|
227 | 229 | ) |
|
228 | 230 | |
|
229 | if upgrade_actions.sharesafe.name in addedreqs: | |
|
230 | ui.warn( | |
|
231 | _( | |
|
232 | b'repository upgraded to share safe mode, existing' | |
|
233 | b' shares will still work in old non-safe mode. ' | |
|
234 | b'Re-share existing shares to use them in safe mode' | |
|
235 | b' New shares will be created in safe mode.\n' | |
|
236 | ) | |
|
237 | ) | |
|
238 | if upgrade_actions.sharesafe.name in removedreqs: | |
|
239 | ui.warn( | |
|
240 | _( | |
|
241 | b'repository downgraded to not use share safe mode, ' | |
|
242 | b'existing shares will not work and needs to' | |
|
243 | b' be reshared.\n' | |
|
244 | ) | |
|
245 | ) | |
|
231 | upgrade_op.print_post_op_messages() |
@@ -57,6 +57,14 b' class improvement(object):' | |||
|
57 | 57 | upgrademessage |
|
58 | 58 | Message intended for humans explaining what an upgrade addressing this |
|
59 | 59 | issue will do. Should be worded in the future tense. |
|
60 | ||
|
61 | postupgrademessage | |
|
62 | Message intended for humans which will be shown post an upgrade | |
|
63 | operation when the improvement will be added | |
|
64 | ||
|
65 | postdowngrademessage | |
|
66 | Message intended for humans which will be shown post an upgrade | |
|
67 | operation in which this improvement was removed | |
|
60 | 68 | """ |
|
61 | 69 | |
|
62 | 70 | def __init__(self, name, type, description, upgrademessage): |
@@ -64,6 +72,8 b' class improvement(object):' | |||
|
64 | 72 | self.type = type |
|
65 | 73 | self.description = description |
|
66 | 74 | self.upgrademessage = upgrademessage |
|
75 | self.postupgrademessage = None | |
|
76 | self.postdowngrademessage = None | |
|
67 | 77 | |
|
68 | 78 | def __eq__(self, other): |
|
69 | 79 | if not isinstance(other, improvement): |
@@ -109,6 +119,14 b' class formatvariant(improvement):' | |||
|
109 | 119 | # value of current Mercurial default for new repository |
|
110 | 120 | default = None |
|
111 | 121 | |
|
122 | # Message intended for humans which will be shown post an upgrade | |
|
123 | # operation when the improvement will be added | |
|
124 | postupgrademessage = None | |
|
125 | ||
|
126 | # Message intended for humans which will be shown post an upgrade | |
|
127 | # operation in which this improvement was removed | |
|
128 | postdowngrademessage = None | |
|
129 | ||
|
112 | 130 | def __init__(self): |
|
113 | 131 | raise NotImplementedError() |
|
114 | 132 | |
@@ -235,6 +253,19 b' class sharesafe(requirementformatvariant' | |||
|
235 | 253 | b'shares of this repository share its requirements and configs.' |
|
236 | 254 | ) |
|
237 | 255 | |
|
256 | postdowngrademessage = _( | |
|
257 | b'repository downgraded to not use share safe mode, ' | |
|
258 | b'existing shares will not work and needs to' | |
|
259 | b' be reshared.' | |
|
260 | ) | |
|
261 | ||
|
262 | postupgrademessage = _( | |
|
263 | b'repository upgraded to share safe mode, existing' | |
|
264 | b' shares will still work in old non-safe mode. ' | |
|
265 | b'Re-share existing shares to use them in safe mode' | |
|
266 | b' New shares will be created in safe mode.' | |
|
267 | ) | |
|
268 | ||
|
238 | 269 | |
|
239 | 270 | @registerformatvariant |
|
240 | 271 | class sparserevlog(requirementformatvariant): |
@@ -585,6 +616,7 b' class UpgradeOperation(object):' | |||
|
585 | 616 | new_requirements, |
|
586 | 617 | current_requirements, |
|
587 | 618 | upgrade_actions, |
|
619 | removed_actions, | |
|
588 | 620 | revlogs_to_process, |
|
589 | 621 | ): |
|
590 | 622 | self.ui = ui |
@@ -593,6 +625,7 b' class UpgradeOperation(object):' | |||
|
593 | 625 | # list of upgrade actions the operation will perform |
|
594 | 626 | self.upgrade_actions = upgrade_actions |
|
595 | 627 | self._upgrade_actions_names = set([a.name for a in upgrade_actions]) |
|
628 | self.removed_actions = removed_actions | |
|
596 | 629 | self.revlogs_to_process = revlogs_to_process |
|
597 | 630 | # requirements which will be added by the operation |
|
598 | 631 | self._added_requirements = ( |
@@ -679,6 +712,15 b' class UpgradeOperation(object):' | |||
|
679 | 712 | """ Check whether the upgrade operation will perform this action """ |
|
680 | 713 | return name in self._upgrade_actions_names |
|
681 | 714 | |
|
715 | def print_post_op_messages(self): | |
|
716 | """ print post upgrade operation warning messages """ | |
|
717 | for a in self.upgrade_actions: | |
|
718 | if a.postupgrademessage is not None: | |
|
719 | self.ui.warn(b'%s\n' % a.postupgrademessage) | |
|
720 | for a in self.removed_actions: | |
|
721 | if a.postdowngrademessage is not None: | |
|
722 | self.ui.warn(b'%s\n' % a.postdowngrademessage) | |
|
723 | ||
|
682 | 724 | |
|
683 | 725 | ### Code checking if a repository can got through the upgrade process at all. # |
|
684 | 726 |
General Comments 0
You need to be logged in to leave comments.
Login now