Chad Woolley wrote:

Check Project#build_if_necessary
It says:  return build(source_control.latest_revision, reasons)

This now hardcodes to build the latest revision.

To accomplish what you want, maybe you could add a #revision_to_build
property on SuccessfulBuildTrigger, and use that instead of
latest_revision.  This would be an API change to the trigger, though,
so you'd probably want to default to the latest revision if there was
no #revision_to_build property or it was nil.

Thanks for the sketch.

For posterity's sake, here's the hack we cobbled together:

diff --git a/app/models/project.rb b/app/models/project.rb
index 5784d2e..e6c23a6 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -210,7 +210,11 @@ class Project
     begin
       if build_necessary?(reasons = [])
         remove_build_requested_flag_file if build_requested?
-        return build(source_control.latest_revision, reasons)
+        revision = source_control.latest_revision
+        if (triggered_by.first.respond_to?(:revision_to_build) )
+          revision = triggered_by.first.revision_to_build
+        end
+        return build(revision, reasons)
       else
         return nil
       end
@@ -523,4 +527,4 @@ def plugin_loader.load_all

 end

-plugin_loader.load_all
\ No newline at end of file
+plugin_loader.load_all
diff --git a/app/models/successful_build_trigger.rb 
b/app/models/successful_build_trig
index a768332..7816a79 100644
--- a/app/models/successful_build_trigger.rb
+++ b/app/models/successful_build_trigger.rb
@@ -40,6 +40,11 @@ class SuccessfulBuildTrigger
     @triggering_project = Project.new(value.to_s)
   end

+  def revision_to_build
+    number = last_successful(@triggering_project.builds).revision
+    SourceControl::Subversion::Revision.new(number)
+  end
+
   private

Regards,
--
Bil Kleb
http://fun3d.larc.nas.gov
_______________________________________________
Cruisecontrolrb-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users

Reply via email to