lib/autobuild/importer.rb in autobuild-1.10.0.b1 vs lib/autobuild/importer.rb in autobuild-1.10.0.b2

- old
+ new

@@ -70,33 +70,40 @@ # More options are specific to each importer type. def initialize(options) @options = options.dup @options[:retry_count] = Integer(@options[:retry_count] || 0) @repository_id = options[:repository_id] || "#{self.class.name}:#{object_id}" + @interactive = options[:interactive] @source_id = options[:source_id] || @repository_id end # Returns a string that identifies the remote repository uniquely # # This can be used to check whether two importers are pointing to the same # repository, regardless of e.g. the access protocol used. For instance, # two git importers that point to the same repository but different branches # would have the same repository_id but different source_id # + # @return [String] # @see source_id attr_reader :repository_id # Returns a string that identifies the remote source uniquely # # This can be used to check whether two importers are pointing to the same # code base inside the same repository. For instance, two git importers that # point to the same repository but different branches would have the same # repository_id but different source_id # + # @return [String] # @see repository_id attr_reader :source_id + # Whether this importer will need interaction with the user, for instance to + # give credentials + def interactive?; !!@interactive end + # The number of times update / checkout should be retried before giving up. # The default is 0 (do not retry) # # Set either with #retry_count= or by setting the :retry_count option when # constructing this importer @@ -202,15 +209,15 @@ raise rescue Autobuild::Exception => e fallback(e, package, :import, package) end - def perform_checkout(package) + def perform_checkout(package, options = Hash.new) package.progress_start "checking out %s", :done_message => 'checked out %s' do retry_count = 0 begin - checkout(package) + checkout(package, options) rescue Interrupt raise rescue ::Exception => original_error retry_count = update_retry_count(original_error, retry_count) if !retry_count @@ -266,11 +273,12 @@ options = Kernel.validate_options options, only_local: false, reset: false, checkout_only: false, - ignore_errors: false + ignore_errors: false, + allow_interactive: true ignore_errors = options.delete(:ignore_errors) importdir = package.importdir if File.directory?(importdir) package.isolate_errors(mark_as_failed: false, ignore_errors: ignore_errors) do @@ -286,10 +294,10 @@ elsif File.exist?(importdir) raise ConfigException.new(package, 'import'), "#{importdir} exists but is not a directory" else package.isolate_errors(mark_as_failed: true, ignore_errors: ignore_errors) do - perform_checkout(package) + perform_checkout(package, allow_interactive: options[:allow_interactive]) end end end # Tries to find a fallback importer because of the given error.