changeset 18161:5b117f82cbdb

obsolete: introduce a troubles method on context A troubled changeset may be affected by multiple trouble at the same time. This new method returns a list of all troubles affecting a changes.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Mon, 17 Dec 2012 15:17:54 +0100
parents dc526561111c
children df1b37c8ae67
files mercurial/context.py
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Mon Dec 17 15:06:15 2012 +0100
+++ b/mercurial/context.py	Mon Dec 17 15:17:54 2012 +0100
@@ -268,6 +268,23 @@
         """True if the changeset is either unstable, bumped or divergent"""
         return self.unstable() or self.bumped() or self.divergent()
 
+    def troubles(self):
+        """return the list of troubles affecting this changesets.
+
+        Troubles are returned as strings. possible values are:
+        - unstable,
+        - bumped,
+        - divergent.
+        """
+        troubles = []
+        if self.unstable():
+            troubles.append('unstable')
+        if self.bumped():
+            troubles.append('bumped')
+        if self.divergent():
+            troubles.append('divergent')
+        return troubles
+
     def _fileinfo(self, path):
         if '_manifest' in self.__dict__:
             try: