##// 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 120 upgrademessage
121 121 Message intended for humans explaining what an upgrade addressing this
122 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 125 self.name = name
134 126 self.type = type
135 127 self.description = description
136 128 self.upgrademessage = upgrademessage
137 129
138 for k, v in kwargs.items():
139 setattr(self, k, v)
140
141 130 def __eq__(self, other):
142 131 if not isinstance(other, improvement):
143 132 # This is what python tell use to do
@@ -150,6 +139,27 class improvement(object):
150 139 def __hash__(self):
151 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 163 def finddeficiencies(repo):
154 164 """returns a list of deficiencies that the repo suffer from"""
155 165 newreporeqs = localrepo.newreporequirements(repo)
@@ -161,9 +171,8 def finddeficiencies(repo):
161 171 # requirements, so let's not bother.
162 172
163 173 if 'fncache' not in repo.requirements:
164 deficiencies.append(improvement(
174 deficiencies.append(formatvariant(
165 175 name='fncache',
166 type=deficiency,
167 176 description=_('long and reserved filenames may not work correctly; '
168 177 'repository performance is sub-optimal'),
169 178 upgrademessage=_('repository will be more resilient to storing '
@@ -173,9 +182,8 def finddeficiencies(repo):
173 182 fromconfig='fncache' in newreporeqs))
174 183
175 184 if 'dotencode' not in repo.requirements:
176 deficiencies.append(improvement(
185 deficiencies.append(formatvariant(
177 186 name='dotencode',
178 type=deficiency,
179 187 description=_('storage of filenames beginning with a period or '
180 188 'space may not work correctly'),
181 189 upgrademessage=_('repository will be better able to store files '
@@ -184,9 +192,8 def finddeficiencies(repo):
184 192 fromconfig='dotencode' in newreporeqs))
185 193
186 194 if 'generaldelta' not in repo.requirements:
187 deficiencies.append(improvement(
195 deficiencies.append(formatvariant(
188 196 name='generaldelta',
189 type=deficiency,
190 197 description=_('deltas within internal storage are unable to '
191 198 'choose optimal revisions; repository is larger and '
192 199 'slower than it could be; interaction with other '
@@ -208,9 +215,8 def finddeficiencies(repo):
208 215 for rev in cl:
209 216 chainbase = cl.chainbase(rev)
210 217 if chainbase != rev:
211 deficiencies.append(improvement(
218 deficiencies.append(formatvariant(
212 219 name='removecldeltachain',
213 type=deficiency,
214 220 description=_('changelog storage is using deltas instead of '
215 221 'raw entries; changelog reading and any '
216 222 'operation relying on changelog data are slower '
General Comments 0
You need to be logged in to leave comments. Login now