Index: lib/damagecontrol/core/BuildExecutor.rb =================================================================== --- lib/damagecontrol/core/BuildExecutor.rb (revision 1216) +++ lib/damagecontrol/core/BuildExecutor.rb (working copy) @@ -53,7 +53,7 @@ # is running. therefore, specify nil and get the latest. In worst case we'll get # some more changes than wanted in case someone committed files after the build request, # but chances of this happening are rather slim, and if it happens it isn't a big problem. - current_scm.checkout(checkout_dir, nil) do |line| + current_scm.checkout(checkout_dir) do |line| stdout(line) end @@ -164,27 +164,22 @@ end begin - # TODO: refactor. same code as in SCMPoller - last_completed_build = @build_history_repository.last_completed_build(current_build.project_name) - from_time = last_completed_build ? last_completed_build.scm_commit_time : nil - from_time = from_time ? from_time + 1 : nil + last_commit_time = @build_history_repository.last_commit_time(current_build.project_name) + from_time = last_commit_time ? last_commit_time + 1 : Time.epoch changesets = current_build.changesets if !current_build.changesets.empty? logger.info("Not determining changeset for #{current_build.project_name} because other component (such as SCMPoller) has already determined it") else - logger.info("Determining changesets for #{current_build.project_name} from #{from_time}") - changesets = current_scm.changesets(checkout_dir, from_time, nil, nil) {|line| stdout(line)} + logger.info("Determining changesets for #{current_build.project_name} from #{from_time} (inclusive)") + changesets = current_scm.changesets(checkout_dir, from_time) {|line| stdout(line)} end # Only store changesets if the previous commit time was known - current_build.changesets = changesets if changesets && from_time + current_build.changesets = changesets if changesets && last_commit_time - # Set last commit time - changesets = changesets.sort do |a,b| - a.time <=> b.time - end - current_build.scm_commit_time = changesets[-1] ? changesets[-1].time : @build_history_repository.last_commit_time(current_build.project_name) + latest = changesets.latest + current_build.scm_commit_time = latest ? latest.time : @build_history_repository.last_commit_time(current_build.project_name) logger.info("Done determining changesets for #{current_build.project_name}. Last commit time: #{current_build.scm_commit_time}") @channel.put(BuildStateChangedEvent.new(current_build)) rescue Exception => e Index: lib/damagecontrol/core/BuildHistoryRepository.rb =================================================================== --- lib/damagecontrol/core/BuildHistoryRepository.rb (revision 1216) +++ lib/damagecontrol/core/BuildHistoryRepository.rb (working copy) @@ -84,13 +84,17 @@ nil end - # returns the commit time for the last build that had a registered commit time. + # Returns the commit time for the last build that had a registered commit time + # or nil if none was found. def last_commit_time(project_name) + result = nil @project_directories.build_dirs(project_name).reverse.each do |build_dir| build = @build_serializer.load(build_dir, false) - return build.scm_commit_time if build.scm_commit_time + result = build.scm_commit_time if build.scm_commit_time end - nil + msg = result ? result : "(we don't know)" + logger.info("Last commit time for #{project_name} was #{msg}") + result end def last_successful_build(project_name, with_changesets=false) @@ -131,8 +135,6 @@ config_map["project_name"] = project_name config_map end - -#### Files and directories #### private Index: lib/damagecontrol/core/Build.rb =================================================================== --- lib/damagecontrol/core/Build.rb (revision 1216) +++ lib/damagecontrol/core/Build.rb (working copy) @@ -128,6 +128,11 @@ dc_creation_time == o.dc_creation_time && changesets == o.changesets end + + def changesets=(changesets) + raise "changesets must be of type #{ChangeSets.name} - was #{changesets.class.name}" unless changesets.is_a?(::RSCM::ChangeSets) + @changesets = changesets + end def __get_instance_variables (instance_variables.reject {|var| var == "@html_url"}).collect {|var| [var[1..-1], eval(var)] } Index: lib/damagecontrol/core/SCMPoller.rb =================================================================== --- lib/damagecontrol/core/SCMPoller.rb (revision 1216) +++ lib/damagecontrol/core/SCMPoller.rb (working copy) @@ -50,25 +50,14 @@ # check for any changes since last completed build and now checkout_dir = @project_directories.checkout_dir(project_name) - # TODO: refactor. same code as in BuildExecutor - last_successful_build = @build_history_repository.last_completed_build(project_name) - from_time = last_completed_build ? last_completed_build.scm_commit_time : nil - from_time = from_time ? from_time + 1 : nil + last_commit_time = @build_history_repository.last_commit_time(current_build.project_name) + from_time = last_commit_time ? last_commit_time + 1 : Time.epoch - if(scm.uptodate?( - checkout_dir, - from_time, - nil - )) + if(scm.uptodate?(checkout_dir, from_time)) logger.info("#{project_name} seems to be uptodate") else - logger.info("changes in #{project_name}, requesting build") - changesets = scm.changesets( - checkout_dir, - from_time, - nil, - nil - ) + logger.info("Local working copy for #{project_name} is not uptodate, getting changesets and requesting build") + changesets = scm.changesets(checkout_dir, from_time) if(changesets.empty?) logger.info("WARNING!!!! we decided #{project_name} was not uptodate, yet there were no changes. This is contradictory!!") return Index: lib/damagecontrol/DamageControlServer.rb =================================================================== --- lib/damagecontrol/DamageControlServer.rb (revision 1216) +++ lib/damagecontrol/DamageControlServer.rb (working copy) @@ -34,6 +34,7 @@ require 'damagecontrol/xmlrpc/ConnectionTester' require 'damagecontrol/xmlrpc/ServerControl' +require 'damagecontrol/scm/StarTeamWebConfigurator' require 'damagecontrol/scm/CVSWebConfigurator' require 'damagecontrol/scm/SVNWebConfigurator' require 'damagecontrol/scm/NoSCMWebConfigurator' @@ -290,7 +291,8 @@ [ DamageControl::NoSCMWebConfigurator, DamageControl::CVSWebConfigurator, - DamageControl::SVNWebConfigurator + DamageControl::SVNWebConfigurator, + DamageControl::StarTeamWebConfigurator ] end Index: lib/damagecontrol/web/images/Thumbs.db =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: lib/damagecontrol/web/AbstractAdminServlet.rb =================================================================== --- lib/damagecontrol/web/AbstractAdminServlet.rb (revision 1216) +++ lib/damagecontrol/web/AbstractAdminServlet.rb (working copy) @@ -156,7 +156,7 @@ def task(params) icon = params[:icon] # || required_param(:icon) - url = params[:url] || required_param(:url) + url = params[:url] # || required_param(:url) name = params[:name] || required_param(:name) erb("components/task.erb", binding) end