This revision was automatically updated to reflect the committed changes.
Closed by commit rHGab0c55c2ad9a: context: rename troubles into instabilities 
(authored by lothiraldan).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D238?vs=664&id=694

REVISION DETAIL
  https://phab.mercurial-scm.org/D238

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/context.py
  mercurial/exchange.py
  mercurial/templatekw.py

CHANGE DETAILS

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -783,7 +783,7 @@
     (EXPERIMENTAL)
     """
     args = pycompat.byteskwargs(args)
-    return showlist('trouble', args['ctx'].troubles(), args)
+    return showlist('trouble', args['ctx'].instabilities(), args)
 
 # tell hggettext to extract docstrings from these functions:
 i18nfunctions = keywords.values()
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -681,7 +681,9 @@
                 if ctx.obsolete():
                     raise error.Abort(mso % ctx)
                 elif ctx.troubled():
-                    raise error.Abort(mst[ctx.troubles()[0]] % ctx)
+                    # TODO print more than one instability in the abort
+                    # message
+                    raise error.Abort(mst[ctx.instabilities()[0]] % ctx)
 
         discovery.checkheads(pushop)
     return True
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -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"""
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4850,9 +4850,10 @@
         if p.obsolete():
             ui.write(_(' (obsolete)'))
         if p.troubled():
+            instabilities = (ui.label(instability, 'trouble.%s' % instability)
+                             for instability in p.instabilities())
             ui.write(' ('
-                     + ', '.join(ui.label(trouble, 'trouble.%s' % trouble)
-                                 for trouble in p.troubles())
+                     + ', '.join(instabilities)
                      + ')')
         ui.write('\n')
         if p.description():
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1466,8 +1466,8 @@
         labels.append('changeset.obsolete')
     if ctx.troubled():
         labels.append('changeset.troubled')
-        for trouble in ctx.troubles():
-            labels.append('trouble.%s' % trouble)
+        for instability in ctx.instabilities():
+            labels.append('trouble.%s' % instability)
     return ' '.join(labels)
 
 class changeset_printer(object):
@@ -1579,7 +1579,8 @@
 
         if ctx.troubled():
             # i18n: column positioning for "hg log"
-            self.ui.write(_("instability: %s\n") % ', '.join(ctx.troubles()),
+            instabilities = ctx.instabilities()
+            self.ui.write(_("instability: %s\n") % ', '.join(instabilities),
                           label='log.trouble')
 
         self._exthook(ctx)



To: lothiraldan, #hg-reviewers, indygreg
Cc: durin42, indygreg, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to