comparison mercurial/context.py @ 33752:ab0c55c2ad9a

context: rename troubles into instabilities Rename troubles context method into instabilities. Copy the old troubles method and add a deprecation warning. This way extensions calling troubles will see the deprecation warning but will not break due to new return values. The renaming is done according to https://www.mercurial-scm.org/wiki/CEDVocabulary. Differential Revision: https://phab.mercurial-scm.org/D238
author Boris Feld <boris.feld@octobus.net>
date Wed, 02 Aug 2017 18:34:39 +0200
parents 9c27a2891b75
children f163edb45c47
comparison
equal deleted inserted replaced
33751:86ea201eaeb9 33752:ab0c55c2ad9a
224 def troubled(self): 224 def troubled(self):
225 """True if the changeset is either unstable, bumped or divergent""" 225 """True if the changeset is either unstable, bumped or divergent"""
226 return self.unstable() or self.bumped() or self.divergent() 226 return self.unstable() or self.bumped() or self.divergent()
227 227
228 def troubles(self): 228 def troubles(self):
229 """return the list of troubles affecting this changesets. 229 """Keep the old version around in order to avoid breaking extensions
230 230 about different return values.
231 Troubles are returned as strings. possible values are: 231 """
232 msg = ("'context.troubles' is deprecated, "
233 "use 'context.instabilities'")
234 self._repo.ui.deprecwarn(msg, '4.4')
235
236 troubles = []
237 if self.unstable():
238 troubles.append('orphan')
239 if self.bumped():
240 troubles.append('bumped')
241 if self.divergent():
242 troubles.append('divergent')
243 return troubles
244
245 def instabilities(self):
246 """return the list of instabilities affecting this changeset.
247
248 Instabilities are returned as strings. possible values are:
232 - orphan, 249 - orphan,
233 - phase-divergent, 250 - phase-divergent,
234 - content-divergent. 251 - content-divergent.
235 """ 252 """
236 troubles = [] 253 instabilities = []
237 if self.unstable(): 254 if self.unstable():
238 troubles.append('orphan') 255 instabilities.append('orphan')
239 if self.bumped(): 256 if self.bumped():
240 troubles.append('phase-divergent') 257 instabilities.append('phase-divergent')
241 if self.divergent(): 258 if self.divergent():
242 troubles.append('content-divergent') 259 instabilities.append('content-divergent')
243 return troubles 260 return instabilities
244 261
245 def parents(self): 262 def parents(self):
246 """return contexts for each parent changeset""" 263 """return contexts for each parent changeset"""
247 return self._parents 264 return self._parents
248 265