obsolete: add easy way to iterate over obsolete marker object
authorPierre-Yves.David@ens-lyon.org
Mon, 04 Jun 2012 00:50:19 +0200
changeset 17073 3a79a5682af1
parent 17072 517af63ba382
child 17074 178a2e85d426
obsolete: add easy way to iterate over obsolete marker object
mercurial/obsolete.py
--- a/mercurial/obsolete.py	Thu Jun 07 19:19:58 2012 +0200
+++ b/mercurial/obsolete.py	Mon Jun 04 00:50:19 2012 +0200
@@ -163,6 +163,9 @@
         self.precursors = {}
         self.successors = {}
 
+    def __iter__(self):
+        return iter(self._all)
+
     def create(self, prec, succs=(), flag=0, metadata=None):
         """obsolete: add a new obsolete marker
 
@@ -218,3 +221,11 @@
             data.extend(sucs)
             stream.write(_pack(format, *data))
             stream.write(metadata)
+
+
+
+def allmarkers(repo):
+    """all obsolete markers known in a repository"""
+    for markerdata in repo.obsstore:
+        yield marker(repo, markerdata)
+