diff mercurial/obsutil.py @ 33155:a14e2e7f7d1f

obsutil: move 'getmarkers' to the new modules We have a new 'obsutil' module now. We move the high level utility there to bring 'obsolete.py' back to a more reasonable size.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 27 Jun 2017 02:06:15 +0200
parents 4e30168d7939
children 53b3a1968aa6
line wrap: on
line diff
--- a/mercurial/obsutil.py	Tue Jun 27 01:51:40 2017 +0200
+++ b/mercurial/obsutil.py	Tue Jun 27 02:06:15 2017 +0200
@@ -48,6 +48,21 @@
         """The flags field of the marker"""
         return self._data[2]
 
+def getmarkers(repo, nodes=None, exclusive=False):
+    """returns markers known in a repository
+
+    If <nodes> is specified, only markers "relevant" to those nodes are are
+    returned"""
+    if nodes is None:
+        rawmarkers = repo.obsstore
+    elif exclusive:
+        rawmarkers = exclusivemarkers(repo, nodes)
+    else:
+        rawmarkers = repo.obsstore.relevantmarkers(nodes)
+
+    for markerdata in rawmarkers:
+        yield marker(repo, markerdata)
+
 def closestpredecessors(repo, nodeid):
     """yield the list of next predecessors pointing on visible changectx nodes