##// END OF EJS Templates
upgrade: introduce a 'formatvariant' class...
Pierre-Yves David -
r32030:e4722357 default
parent child Browse files
Show More
@@ -120,24 +120,13 class improvement(object):
120 upgrademessage
120 upgrademessage
121 Message intended for humans explaining what an upgrade addressing this
121 Message intended for humans explaining what an upgrade addressing this
122 issue will do. Should be worded in the future tense.
122 issue will do. Should be worded in the future tense.
123
124 fromdefault (``deficiency`` types only)
125 Boolean indicating whether the current (deficient) state deviates
126 from Mercurial's default configuration.
127
128 fromconfig (``deficiency`` types only)
129 Boolean indicating whether the current (deficient) state deviates
130 from the current Mercurial configuration.
131 """
123 """
132 def __init__(self, name, type, description, upgrademessage, **kwargs):
124 def __init__(self, name, type, description, upgrademessage):
133 self.name = name
125 self.name = name
134 self.type = type
126 self.type = type
135 self.description = description
127 self.description = description
136 self.upgrademessage = upgrademessage
128 self.upgrademessage = upgrademessage
137
129
138 for k, v in kwargs.items():
139 setattr(self, k, v)
140
141 def __eq__(self, other):
130 def __eq__(self, other):
142 if not isinstance(other, improvement):
131 if not isinstance(other, improvement):
143 # This is what python tell use to do
132 # This is what python tell use to do
@@ -150,6 +139,27 class improvement(object):
150 def __hash__(self):
139 def __hash__(self):
151 return hash(self.name)
140 return hash(self.name)
152
141
142 class formatvariant(improvement):
143 """an improvement subclass dedicated to repository format
144
145 extra attributes:
146
147 fromdefault (``deficiency`` types only)
148 Boolean indicating whether the current (deficient) state deviates
149 from Mercurial's default configuration.
150
151 fromconfig (``deficiency`` types only)
152 Boolean indicating whether the current (deficient) state deviates
153 from the current Mercurial configuration.
154 """
155
156 def __init__(self, name, description, upgrademessage, fromdefault,
157 fromconfig):
158 super(formatvariant, self).__init__(name, deficiency, description,
159 upgrademessage)
160 self.fromdefault = fromdefault
161 self.fromconfig = fromconfig
162
153 def finddeficiencies(repo):
163 def finddeficiencies(repo):
154 """returns a list of deficiencies that the repo suffer from"""
164 """returns a list of deficiencies that the repo suffer from"""
155 newreporeqs = localrepo.newreporequirements(repo)
165 newreporeqs = localrepo.newreporequirements(repo)
@@ -161,9 +171,8 def finddeficiencies(repo):
161 # requirements, so let's not bother.
171 # requirements, so let's not bother.
162
172
163 if 'fncache' not in repo.requirements:
173 if 'fncache' not in repo.requirements:
164 deficiencies.append(improvement(
174 deficiencies.append(formatvariant(
165 name='fncache',
175 name='fncache',
166 type=deficiency,
167 description=_('long and reserved filenames may not work correctly; '
176 description=_('long and reserved filenames may not work correctly; '
168 'repository performance is sub-optimal'),
177 'repository performance is sub-optimal'),
169 upgrademessage=_('repository will be more resilient to storing '
178 upgrademessage=_('repository will be more resilient to storing '
@@ -173,9 +182,8 def finddeficiencies(repo):
173 fromconfig='fncache' in newreporeqs))
182 fromconfig='fncache' in newreporeqs))
174
183
175 if 'dotencode' not in repo.requirements:
184 if 'dotencode' not in repo.requirements:
176 deficiencies.append(improvement(
185 deficiencies.append(formatvariant(
177 name='dotencode',
186 name='dotencode',
178 type=deficiency,
179 description=_('storage of filenames beginning with a period or '
187 description=_('storage of filenames beginning with a period or '
180 'space may not work correctly'),
188 'space may not work correctly'),
181 upgrademessage=_('repository will be better able to store files '
189 upgrademessage=_('repository will be better able to store files '
@@ -184,9 +192,8 def finddeficiencies(repo):
184 fromconfig='dotencode' in newreporeqs))
192 fromconfig='dotencode' in newreporeqs))
185
193
186 if 'generaldelta' not in repo.requirements:
194 if 'generaldelta' not in repo.requirements:
187 deficiencies.append(improvement(
195 deficiencies.append(formatvariant(
188 name='generaldelta',
196 name='generaldelta',
189 type=deficiency,
190 description=_('deltas within internal storage are unable to '
197 description=_('deltas within internal storage are unable to '
191 'choose optimal revisions; repository is larger and '
198 'choose optimal revisions; repository is larger and '
192 'slower than it could be; interaction with other '
199 'slower than it could be; interaction with other '
@@ -208,9 +215,8 def finddeficiencies(repo):
208 for rev in cl:
215 for rev in cl:
209 chainbase = cl.chainbase(rev)
216 chainbase = cl.chainbase(rev)
210 if chainbase != rev:
217 if chainbase != rev:
211 deficiencies.append(improvement(
218 deficiencies.append(formatvariant(
212 name='removecldeltachain',
219 name='removecldeltachain',
213 type=deficiency,
214 description=_('changelog storage is using deltas instead of '
220 description=_('changelog storage is using deltas instead of '
215 'raw entries; changelog reading and any '
221 'raw entries; changelog reading and any '
216 'operation relying on changelog data are slower '
222 'operation relying on changelog data are slower '
General Comments 0
You need to be logged in to leave comments. Login now