Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/context.py Tue Aug 08 17:25:38 2017 -0700 +++ b/mercurial/context.py Wed Aug 02 18:34:39 2017 +0200 @@ -226,21 +226,38 @@ return self.unstable() or self.bumped() or self.divergent() def troubles(self): - """return the list of troubles affecting this changesets. + """Keep the old version around in order to avoid breaking extensions + about different return values. + """ + msg = ("'context.troubles' is deprecated, " + "use 'context.instabilities'") + self._repo.ui.deprecwarn(msg, '4.4') - Troubles are returned as strings. possible values are: + troubles = [] + if self.unstable(): + troubles.append('orphan') + if self.bumped(): + troubles.append('bumped') + if self.divergent(): + troubles.append('divergent') + return troubles + + def instabilities(self): + """return the list of instabilities affecting this changeset. + + Instabilities are returned as strings. possible values are: - orphan, - phase-divergent, - content-divergent. """ - troubles = [] + instabilities = [] if self.unstable(): - troubles.append('orphan') + instabilities.append('orphan') if self.bumped(): - troubles.append('phase-divergent') + instabilities.append('phase-divergent') if self.divergent(): - troubles.append('content-divergent') - return troubles + instabilities.append('content-divergent') + return instabilities def parents(self): """return contexts for each parent changeset"""