changeset 17073:3a79a5682af1

obsolete: add easy way to iterate over obsolete marker object
author Pierre-Yves.David@ens-lyon.org
date Mon, 04 Jun 2012 00:50:19 +0200
parents 517af63ba382
children 178a2e85d426
files mercurial/obsolete.py
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)
+