# HG changeset patch # User Pierre-Yves.David@ens-lyon.org # Date 2012-06-03 22:50:19 # Node ID 3a79a5682af15e462a90dd9812d0df55ea3794b7 # Parent 517af63ba382af19020b21c221f7a2b9cb9d8469 obsolete: add easy way to iterate over obsolete marker object diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -163,6 +163,9 @@ class obsstore(object): 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 @@ class obsstore(object): 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) +