alias_method :browse, :show
+ def fetch_changesets
+ @repository.fetch_changesets if @project.active? && @path.empty? && !Setting.autofetch_changesets?
+ show
+ end
+
def changes
@entry = @repository.entry(@path, @rev)
(show_error_not_found; return) unless @entry
<%= link_to_if_authorized l(:label_settings),
{:controller => 'projects', :action => 'settings', :id => @project, :tab => 'repositories'},
:class => 'icon icon-settings' if User.current.allowed_to?(:manage_repository, @project) %>
+ <%= link_to l(:button_fetch_changesets),
+ {:action => :fetch_changesets, :id => @project, :repository_id => @repository.identifier_param},
+ :class => 'icon icon-reload', :method => :post if User.current.allowed_to?(:manage_repository, @project) && !Setting.autofetch_changesets? %>
<% end %>
<%= form_tag({:action => controller.action_name,
button_copy: Copy
button_copy_and_follow: Copy and follow
button_annotate: Annotate
+ button_fetch_changesets: Fetch commits
button_update: Update
button_configure: Configure
button_quote: Quote
# repositories routes
get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats'
get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph'
+ post 'projects/:id/repository/:repository_id/fetch_changesets', :to => 'repositories#fetch_changesets'
get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision'
get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision'
map.permission :browse_repository, {:repositories => [:show, :browse, :entry, :raw, :annotate, :changes, :diff, :stats, :graph]}, :read => true
map.permission :commit_access, {}
map.permission :manage_related_issues, {:repositories => [:add_related_issue, :remove_related_issue]}
- map.permission :manage_repository, {:projects => :settings, :repositories => [:new, :create, :edit, :update, :committers, :destroy]}, :require => :member
+ map.permission :manage_repository, {:projects => :settings, :repositories => [:new, :create, :edit, :update, :committers, :destroy, :fetch_changesets]}, :require => :member
end
map.project_module :boards do |map|
assert_response :success
assert_select 'input[value="View differences"]', :count => 0
end
+
+ def test_fetch_changesets
+ @request.session[:user_id] = 2
+ role = Role.find(1)
+
+ with_settings :autofetch_changesets => '0' do
+ role.add_permission! :manage_repository
+ Repository::Subversion.any_instance.expects(:fetch_changesets).once
+ post(:fetch_changesets, :params => {:id => 1, :repository_id => 10})
+ assert_response :success
+
+ role.remove_permission! :manage_repository
+ Repository::Subversion.any_instance.expects(:fetch_changesets).never
+ post(:fetch_changesets, :params => {:id => 1, :repository_id => 10})
+ assert_response :forbidden
+ end
+ end
end
def test_revisions
end
end
+ def test_repositories_fetch_changesets_with_repository_id
+ should_route 'POST /projects/foo/repository/bar/fetch_changesets' => 'repositories#fetch_changesets', :id => 'foo', :repository_id => 'bar'
+ end
+
def test_repositories_non_revisions_path_with_repository_id
should_route 'GET /projects/foo/repository/svn/changes' => 'repositories#changes', :id => 'foo', :repository_id => 'svn', :format => 'html'