lib/autoproj/ops/snapshot.rb in autoproj-2.0.0.b6 vs lib/autoproj/ops/snapshot.rb in autoproj-2.0.0.b7

- old
+ new

@@ -87,26 +87,38 @@ options = Kernel.validate_options options, ignore_errors: false @ignore_errors = options[:ignore_errors] end - def snapshot_package_sets(target_dir = nil) + def snapshot_package_sets(target_dir = nil, options = Hash.new) + options = Kernel.validate_options options, + local: true + result = Array.new manifest.each_package_set do |pkg_set| next if pkg_set.local? - if vcs_info = pkg_set.snapshot(target_dir) + vcs_info = + begin pkg_set.snapshot(target_dir, local: options[:local]) + rescue Exception => e + error_or_warn(pkg_set, e) + next + end + + if vcs_info result << Hash["pkg_set:#{pkg_set.repository_id}", vcs_info] else - error_or_warn(pkg_set, "cannot snapshot #{package_name}: importer snapshot failed") + error_or_warn(pkg_set, "cannot snapshot package set #{pkg_set.name}: importer snapshot failed") end end result end def error_or_warn(package, error) - if ignore_errors? + if error.kind_of?(Interrupt) + raise + elsif ignore_errors? if !error.respond_to?(:to_str) error = error.message end Autoproj.warn error elsif error.respond_to?(:to_str) @@ -114,11 +126,14 @@ else raise end end - def snapshot_packages(packages, target_dir = nil) + def snapshot_packages(packages, target_dir = nil, options = Hash.new) + options = Kernel.validate_options options, + local: true + result = Array.new packages.each do |package_name| package = manifest.packages[package_name] if !package raise ArgumentError, "#{package_name} is not a known package" @@ -131,12 +146,13 @@ error_or_warn(package, "cannot snapshot #{package_name} as the #{importer.class} importer does not support it") next end vcs_info = - begin importer.snapshot(package.autobuild, target_dir) + begin importer.snapshot(package.autobuild, target_dir, local: options[:local]) rescue Exception => e - error_or_warn(package, "cannot snapshot #{package_name}: #{e.message}") + error_or_warn(package, e) + next end if vcs_info result << Hash[package_name, vcs_info] else