--- a/hgext/evolve.py Thu Feb 27 17:20:34 2014 -0800
+++ b/hgext/evolve.py Thu Feb 27 18:30:55 2014 -0800
@@ -682,7 +682,6 @@
except KeyError:
pass # rebase not found
-
#####################################################################
### Old Evolve extension content ###
#####################################################################
@@ -2031,3 +2030,47 @@
entry[1].append(('O', 'old-obsolete', False,
_("make graft obsoletes its source")))
+#####################################################################
+### Obsolescence marker exchange experimenation ###
+#####################################################################
+
+@command('debugobsoleterelevant',
+ [],
+ 'REVSET')
+def debugobsoleterelevant(ui, repo, *revsets):
+ """print allobsolescence marker relevant to a set of revision"""
+ nodes = [ctx.node() for ctx in repo.set('%lr', revsets)]
+ markers = repo.obsstore.relevantmarkers(nodes)
+ for rawmarker in sorted(markers):
+ marker = obsolete.marker(repo, rawmarker)
+ cmdutil.showmarker(ui, marker)
+
+@eh.addattr(obsolete.obsstore, 'relevantmarkers')
+def relevantmarkers(self, nodes):
+ """return a set of all obsolescence marker relevant to a set of node.
+
+ "relevant" to a set of node mean:
+
+ - marker that use this changeset as successors
+ - prune marker of direct children on this changeset.
+ - recursive application of the two rules on precursors of these markers
+
+ It a set so you cannot rely on order"""
+ seennodes = set(nodes)
+ seenmarkers = set()
+ pendingnodes = set(nodes)
+ precursorsmarkers = self.precursors
+ prunedchildren = self.prunedchildren
+ while pendingnodes:
+ direct = set()
+ for current in pendingnodes:
+ direct.update(precursorsmarkers.get(current, ()))
+ direct.update(prunedchildren.get(current, ()))
+ direct -= seenmarkers
+ pendingnodes = set([m[0] for m in direct])
+ seenmarkers |= direct
+ pendingnodes -= seennodes
+ seennodes |= pendingnodes
+ return seenmarkers
+
+