changeset 33730:52c5ff856b49

context: rename troubled into isunstable As we changed the meaning of unstable between the old vocabulary and the new one, we can't reuse the unstable method name at the risk of breaking extensions calling unstable and getting a wrong result. Instead rename troubled into isunstable so extensions will continue to work. The renaming is done according to https://www.mercurial-scm.org/wiki/CEDVocabulary. Differential Revision: https://phab.mercurial-scm.org/D242
author Boris Feld <boris.feld@octobus.net>
date Wed, 02 Aug 2017 19:13:56 +0200
parents 8413cbeae275
children 2cb442bc1a76
files mercurial/cmdutil.py mercurial/commands.py mercurial/context.py mercurial/exchange.py
diffstat 4 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Wed Aug 02 19:09:00 2017 +0200
+++ b/mercurial/cmdutil.py	Wed Aug 02 19:13:56 2017 +0200
@@ -1464,7 +1464,7 @@
     labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()]
     if ctx.obsolete():
         labels.append('changeset.obsolete')
-    if ctx.troubled():
+    if ctx.isunstable():
         labels.append('changeset.troubled')
         for instability in ctx.instabilities():
             labels.append('trouble.%s' % instability)
@@ -1577,7 +1577,7 @@
         self.ui.write(_("date:        %s\n") % date,
                       label='log.date')
 
-        if ctx.troubled():
+        if ctx.isunstable():
             # i18n: column positioning for "hg log"
             instabilities = ctx.instabilities()
             self.ui.write(_("instability: %s\n") % ', '.join(instabilities),
--- a/mercurial/commands.py	Wed Aug 02 19:09:00 2017 +0200
+++ b/mercurial/commands.py	Wed Aug 02 19:13:56 2017 +0200
@@ -4849,7 +4849,7 @@
                 ui.write(_(' (no revision checked out)'))
         if p.obsolete():
             ui.write(_(' (obsolete)'))
-        if p.troubled():
+        if p.isunstable():
             instabilities = (ui.label(instability, 'trouble.%s' % instability)
                              for instability in p.instabilities())
             ui.write(' ('
--- a/mercurial/context.py	Wed Aug 02 19:09:00 2017 +0200
+++ b/mercurial/context.py	Wed Aug 02 19:13:56 2017 +0200
@@ -240,6 +240,12 @@
         return self.rev() in obsmod.getrevs(self._repo, 'divergent')
 
     def troubled(self):
+        msg = ("'context.troubled' is deprecated, "
+               "use 'context.isunstable'")
+        self._repo.ui.deprecwarn(msg, '4.4')
+        return self.unstable()
+
+    def isunstable(self):
         """True if the changeset is either unstable, bumped or divergent"""
         return self.orphan() or self.phasedivergent() or self.contentdivergent()
 
--- a/mercurial/exchange.py	Wed Aug 02 19:09:00 2017 +0200
+++ b/mercurial/exchange.py	Wed Aug 02 19:13:56 2017 +0200
@@ -680,7 +680,7 @@
                 ctx = unfi[node]
                 if ctx.obsolete():
                     raise error.Abort(mso % ctx)
-                elif ctx.troubled():
+                elif ctx.isunstable():
                     # TODO print more than one instability in the abort
                     # message
                     raise error.Abort(mst[ctx.instabilities()[0]] % ctx)