diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-29 04:20:51 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-29 04:20:51 +0000 |
| commit | 9ff80c082a673f18b57a0bf85a28b126a2533eed (patch) | |
| tree | 9aa711d1aebb35a8802d766db563320cdaae6e4a /lib | |
| parent | bb9c813feb3c6a27a3765d593cae56e800b46fb1 (diff) | |
| download | puppet-9ff80c082a673f18b57a0bf85a28b126a2533eed.tar.gz puppet-9ff80c082a673f18b57a0bf85a28b126a2533eed.tar.xz puppet-9ff80c082a673f18b57a0bf85a28b126a2533eed.zip | |
*whew* Okay, simplified the splice method a bit, and I am actually somewhat confident that the stronger testing is correct. I have had a lot of problems with tests usually passing but sometimes failing, mostly because of ordering problems related to multiple edges.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1984 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/pgraph.rb | 64 |
1 files changed, 22 insertions, 42 deletions
diff --git a/lib/puppet/pgraph.rb b/lib/puppet/pgraph.rb index 64f411a40..5ae42045f 100644 --- a/lib/puppet/pgraph.rb +++ b/lib/puppet/pgraph.rb @@ -125,50 +125,30 @@ class Puppet::PGraph < GRATR::Digraph # First create new edges for each of the :in edges [:in, :out].each do |dir| adjacent(vertex, :direction => dir, :type => :edges).each do |edge| - if dir == :in - nvertex = edge.source - else - nvertex = edge.target - end - if nvertex.is_a?(type) - neighbors = other.leaves(nvertex) - else - neighbors = [nvertex] - end - children.each do |child| - neighbors.each do |neighbor| - if dir == :in - s = neighbor - t = child - else - s = child - t = neighbor - end - - if s.is_a?(type) - raise "Source %s is still a container" % s - end - if t.is_a?(type) - raise "Target %s is still a container" % t - end + if dir == :in + s = edge.source + t = child + else + s = child + t = edge.target + end - # We don't want to add multiple copies of the - # same edge, but we *do* want to make sure we - # keep labels around. - # XXX This will *not* work when we support multiple - # types of labels, and only works now because - # you can only do simple subscriptions. - if edge?(s, t) - copy_label(s, t, edge.label) - next - end - add_edge!(s, t, edge.label) - if cyclic? - raise ArgumentError, - "%s => %s results in a loop" % - [s, t] - end + # We don't want to add multiple copies of the + # same edge, but we *do* want to make sure we + # keep labels around. + # XXX This will *not* work when we support multiple + # types of labels, and only works now because + # you can only do simple subscriptions. + if edge?(s, t) + copy_label(s, t, edge.label) + next + end + add_edge!(s, t, edge.label) + if cyclic? + raise ArgumentError, + "%s => %s results in a loop" % + [s, t] end end end |
