obsolete: function and method to access some obsolete data
authorPierre-Yves.David@ens-lyon.org
Wed, 06 Jun 2012 01:56:58 +0200
changeset 17076 75f4180509a4
parent 17075 28ed1c4511ce
child 17090 e64d416b6b94
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.
mercurial/context.py
mercurial/obsolete.py
--- 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)
+