317: def splice!(other, type)
318:
319:
320:
321:
322:
323:
324: stage_class = Puppet::Type.type(:stage)
325: whit_class = Puppet::Type.type(:whit)
326: containers = other.topsort.find_all { |v| (v.is_a?(type) or v.is_a?(stage_class)) and vertex?(v) }
327: containers.each do |container|
328:
329: children = other.adjacent(container, :direction => :out)
330:
331:
332:
333: children = [whit_class.new(:name => container.name, :catalog => other)] if children.empty?
334:
335:
336: [:in, :out].each do |dir|
337: edges = adjacent(container, :direction => dir, :type => :edges)
338: edges.each do |edge|
339: children.each do |child|
340: if dir == :in
341: s = edge.source
342: t = child
343: else
344: s = child
345: t = edge.target
346: end
347:
348: add_edge(s, t, edge.label)
349: end
350:
351:
352: remove_edge!(edge)
353: end
354: end
355: remove_vertex!(container)
356: end
357: end