summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/sys_controller.rb17
-rw-r--r--test/functional/sys_controller_test.rb15
2 files changed, 32 insertions, 0 deletions
diff --git a/app/controllers/sys_controller.rb b/app/controllers/sys_controller.rb
index da4b119a7..5e74192a9 100644
--- a/app/controllers/sys_controller.rb
+++ b/app/controllers/sys_controller.rb
@@ -37,6 +37,23 @@ class SysController < ActionController::Base
end
end
end
+
+ def fetch_changesets
+ projects = []
+ if params[:id]
+ projects << Project.active.has_module(:repository).find(params[:id])
+ else
+ projects = Project.active.has_module(:repository).find(:all, :include => :repository)
+ end
+ projects.each do |project|
+ if project.repository
+ project.repository.fetch_changesets
+ end
+ end
+ render :nothing => true, :status => 200
+ rescue ActiveRecord::RecordNotFound
+ render :nothing => true, :status => 404
+ end
protected
diff --git a/test/functional/sys_controller_test.rb b/test/functional/sys_controller_test.rb
index 59b1d2af6..187fbe410 100644
--- a/test/functional/sys_controller_test.rb
+++ b/test/functional/sys_controller_test.rb
@@ -53,4 +53,19 @@ class SysControllerTest < ActionController::TestCase
assert r.is_a?(Repository::Subversion)
assert_equal 'file:///create/project/repository/subproject2', r.url
end
+
+ def test_fetch_changesets
+ get :fetch_changesets
+ assert_response :success
+ end
+
+ def test_fetch_changesets_one_project
+ get :fetch_changesets, :id => 'ecookbook'
+ assert_response :success
+ end
+
+ def test_fetch_changesets_unknown_project
+ get :fetch_changesets, :id => 'unknown'
+ assert_response 404
+ end
end