lib/autoproj/ops/snapshot.rb in autoproj-2.0.3 vs lib/autoproj/ops/snapshot.rb in autoproj-2.1.0.rc1
- old
+ new
@@ -17,19 +17,16 @@
# @param [Array<String=>Hash>] overrides the information that should augment
# the current state
# @param [Array<String=>Hash>] state the current state
# @param [Hash] the updated information
def self.merge_packets( overrides, state )
- result = overrides.dup
overriden = overrides.map { |entry| entry.keys.first }.to_set
- state.each do |pkg|
+ filtered_state = state.find_all do |pkg|
name, _ = pkg.first
- if !overriden.include?(name)
- result << pkg
- end
+ !overriden.include?(name)
end
- result
+ filtered_state + overrides
end
def self.update_log_available?(manifest)
new(manifest).import_state_log_package
true
@@ -52,10 +49,10 @@
# create direcotry for versions file first
FileUtils.mkdir_p(File.dirname( versions_file ))
# augment the versions file with the updated versions
- Snapshot.merge_packets( versions, existing_versions )
+ versions = Snapshot.merge_packets( versions, existing_versions )
versions = sort_versions(versions)
# write the yaml file
File.open(versions_file, 'w') do |io|