Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Fixed find to traverse snapshots. #52

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/rvc/extensions/VirtualMachine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -274,4 +274,18 @@ def display_info
puts "state: #{tree.state}"
puts "creation time: #{tree.createTime}"
end

def self.traverse?
true
end

field 'type' do
summary "The type of object"
property 'find_tree.class.to_s'
end

field 'name' do
summary "The snapshot name."
property 'find_tree.name'
end
end
7 changes: 3 additions & 4 deletions lib/rvc/modules/find.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,11 @@ def leaves roots, types = []
nodes = new_nodes
new_nodes = Set.new
nodes.each do |node|
if (node.class.traverse? or roots.member? node) and
(types & (node.field('type') || [])).empty?
if (node.class.traverse? or roots.member? node)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain this change?

node.children.each { |k,v| v.rvc_link(node, k); new_nodes << v }
else
leaves << node
end

leaves << node
end
end
leaves
Expand Down