Feature #8875
closedAllow manually fetching changesets
Added by Bart van Andel over 13 years ago. Updated over 3 years ago.
0%
Description
I have Redmine installed on a local, virtual server. Most of my projects are on the same server, but one particular project uses an external SVN repository.
I've noticed that automatically fetching the change sets on every page refresh will result in slower performance. I'd like to see a button to manually fetch changesets on the repository page, so I can disable autofetching (preferably on a per project basis, which is currently not possible) and press this button whenever I see a need for it. I know about the possibility to fetch change sets from the command line, but I think a button will be more user-friendly.
Files
ScreenShot.png (164 KB) ScreenShot.png | Yuichi HARADA, 2020-10-28 06:00 | ||
8875-manually-fetching-changesets.patch (4.51 KB) 8875-manually-fetching-changesets.patch | Yuichi HARADA, 2020-10-28 06:02 | ||
8875-manually-fetching-changesets-v2.patch (5.16 KB) 8875-manually-fetching-changesets-v2.patch | Yuichi HARADA, 2020-12-07 04:11 | ||
icons-are-not-aligned.png (39.5 KB) icons-are-not-aligned.png | Go MAEDA, 2021-01-18 14:18 | ||
icons-are-aligned.png (32.7 KB) icons-are-aligned.png | Yuichi HARADA, 2021-01-19 08:03 | ||
8875-manually-fetching-changesets-v3.patch (5.19 KB) 8875-manually-fetching-changesets-v3.patch | Yuichi HARADA, 2021-01-19 08:07 |
Updated by Yuichi HARADA about 4 years ago
- File ScreenShot.png ScreenShot.png added
- File 8875-manually-fetching-changesets.patch 8875-manually-fetching-changesets.patch added
+1
I made a patch.
- When "Fetch commits automatically" is disabled, show the Fetch changesets button in the dropdown menu.
- If you have the "Browse repository" permission, you can manually fetching changesets.
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index b0108d531..3274b942a 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -100,6 +100,11 @@ class RepositoriesController < ApplicationController
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
diff --git a/app/views/repositories/_navigation.html.erb b/app/views/repositories/_navigation.html.erb
index 730cec42f..326d3f5af 100644
--- a/app/views/repositories/_navigation.html.erb
+++ b/app/views/repositories/_navigation.html.erb
@@ -19,6 +19,9 @@
<%= 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(:label_fetch_changesets),
+ {:action => :fetch_changesets, :id => @project, :repository_id => @repository.identifier_param},
+ :class => 'icon icon-reload' if User.current.allowed_to?(:browse_repository, @project) && !Setting.autofetch_changesets? %>
<% end %>
<%= form_tag({:action => controller.action_name,
diff --git a/config/locales/en.yml b/config/locales/en.yml
index b5245a7df..d81528902 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -802,6 +802,7 @@ en:
label_repository: Repository
label_repository_new: New repository
label_repository_plural: Repositories
+ label_fetch_changesets: Fetch changesets
label_browse: Browse
label_branch: Branch
label_tag: Tag
diff --git a/config/routes.rb b/config/routes.rb
index 5884aa49f..91e07e407 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -262,6 +262,7 @@ Rails.application.routes.draw do
# repositories routes
get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats'
get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph'
+ get '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'
diff --git a/lib/redmine.rb b/lib/redmine.rb
index de2993e13..7c28cc463 100644
--- a/lib/redmine.rb
+++ b/lib/redmine.rb
@@ -175,7 +175,7 @@ Redmine::AccessControl.map do |map|
map.project_module :repository do |map|
map.permission :view_changesets, {:repositories => [:show, :revisions, :revision]}, :read => true
- map.permission :browse_repository, {:repositories => [:show, :browse, :entry, :raw, :annotate, :changes, :diff, :stats, :graph]}, :read => true
+ map.permission :browse_repository, {:repositories => [:show, :browse, :entry, :raw, :annotate, :changes, :diff, :stats, :graph, :fetch_changesets]}, :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
Updated by Go MAEDA about 4 years ago
- Target version set to Candidate for next major release
Updated by Go MAEDA almost 4 years ago
I have been considering who should be allowed to fetch manually changesets. As a result, I came to the conclusion that it might be problematic to allow a member with a "Browse repository" privilege to manual fetching.
Let's take www.redmine.org as an example. Auto-fetching is disabled on this site. Allowing users who have a "Browse repository" privilege to fetch changesets can cause the following problems:
- If a large number of users use this feature, the load on the server will increase
- A malicious anonymous user may carry out a DoS attack
Given these things, I think it is better to make this feature available only to users with "Manage repository" privileges.
Updated by Yuichi HARADA almost 4 years ago
Go MAEDA wrote:
I have been considering who should be allowed to fetch manually changesets. As a result, I came to the conclusion that it might be problematic to allow a member with a "Browse repository" privilege to manual fetching.
Let's take www.redmine.org as an example. Auto-fetching is disabled on this site. Allowing users who have a "Browse repository" privilege to fetch changesets can cause the following problems:
- If a large number of users use this feature, the load on the server will increase
- A malicious anonymous user may carry out a DoS attack
Given these things, I think it is better to make this feature available only to users with "Manage repository" privileges.
Thank you for pointing out.
I've fixed it's only available for roles that have the "Manage repository" privilege. And added a routing test.
Updated by Go MAEDA almost 4 years ago
- Target version changed from Candidate for next major release to 4.2.0
Setting the target version to 4.2.0.
Updated by Go MAEDA almost 4 years ago
- File icons-are-not-aligned.png icons-are-not-aligned.png added
- Target version changed from 4.2.0 to Candidate for next major release
Thank you for updating the patch.
- I am not sure if it is OK to use GET method to fetch changesets. Normally, GET is not supposed to change data
- Icons are not aligned. See the screenshot below
Updated by Yuichi HARADA almost 4 years ago
- File icons-are-aligned.png icons-are-aligned.png added
- File 8875-manually-fetching-changesets-v3.patch 8875-manually-fetching-changesets-v3.patch added
Thank you for pointing this out.
Go MAEDA wrote:
- I am not sure if it is OK to use GET method to fetch changesets. Normally, GET is not supposed to change data
"Fetch changesets" creates Changeset
and Change
from the repository commit logs. I think that POST is appropriate instead of GET, so I fixed it.
- Icons are not aligned. See the screenshot below
Icons are aligned (confirmed by Firefox, Chrome, Safari).
Updated by Go MAEDA over 3 years ago
- Target version changed from Candidate for next major release to 4.2.0
Setting the target version to 4.2.0.
Updated by Go MAEDA over 3 years ago
- Subject changed from Repository: button for manually fetching changesets to Allow manually fetching changesets
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the patch. Thank you for your contribution.
Users with Manage repository permission can manually fetch changesets using the "Fetch commits" button in the action menu.