[PATCH 1 of 3] obsolete: introduce a troubled method on context

pierre-yves.david at logilab.fr pierre-yves.david at logilab.fr
Mon Dec 17 08:41:17 CST 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at logilab.fr>
# Date 1355753175 -3600
# Node ID 3e51efedc357cc451eee807e861efb905de00331
# Parent  8c9a52492d426741ab24392d49f44a1d4f23613e
obsolete: introduce a troubled method on context

Allows to quickly check if a changeset is affected by any troubles.
(troubles are: unstable, bumped and divergent)

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -258,10 +258,14 @@ class changectx(object):
 
         Only non-public and non-obsolete changesets may be divergent.
         """
         return self.rev() in obsmod.getrevs(self._repo, 'divergent')
 
+    def troubled(self):
+        """True if the changeset is either unstable, bumped or divergent"""
+        return self.unstable() or self.bumped() or self.divergent()
+
     def _fileinfo(self, path):
         if '_manifest' in self.__dict__:
             try:
                 return self._manifest[path], self._manifest.flags(path)
             except KeyError:


More information about the Mercurial-devel mailing list