changeset 17076:75f4180509a4

obsolete: function and method to access some obsolete data An `obsolete` boolean property is added to changeset context. Function to get obsolete marker object from a changeset context are added to the obsolete module.
author Pierre-Yves.David@ens-lyon.org
date Wed, 06 Jun 2012 01:56:58 +0200
parents 28ed1c4511ce
children e64d416b6b94
files mercurial/context.py mercurial/obsolete.py
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Thu Jun 07 19:21:59 2012 +0200
+++ b/mercurial/context.py	Wed Jun 06 01:56:58 2012 +0200
@@ -230,6 +230,10 @@
         for d in self._repo.changelog.descendants([self._rev]):
             yield changectx(self._repo, d)
 
+    def obsolete(self):
+        """True if the changeset is obsolete"""
+        return self.node() in self._repo.obsstore.obsoleted
+
     def _fileinfo(self, path):
         if '_manifest' in self.__dict__:
             try:
--- a/mercurial/obsolete.py	Thu Jun 07 19:21:59 2012 +0200
+++ b/mercurial/obsolete.py	Wed Jun 06 01:56:58 2012 +0200
@@ -267,3 +267,13 @@
     for markerdata in repo.obsstore:
         yield marker(repo, markerdata)
 
+def precursormarkers(ctx):
+    """obsolete marker making this changeset obsolete"""
+    for data in ctx._repo.obsstore.precursors.get(ctx.node(), ()):
+        yield marker(ctx._repo, data)
+
+def successormarkers(ctx):
+    """obsolete marker marking this changeset as a successors"""
+    for data in ctx._repo.obsstore.successors.get(ctx.node(), ()):
+        yield marker(ctx._repo, data)
+