Feature #8875

Repository: button for manually fetching changesets

Added by Bart van Andel over 9 years ago. Updated 21 days ago.

Status:NewStart date:2011-07-21
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:SCM
Target version:Candidate for next major release
Resolution:

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.

ScreenShot.png (164 KB) Yuichi HARADA, 2020-10-28 06:00

8875-manually-fetching-changesets.patch Magnifier (4.51 KB) Yuichi HARADA, 2020-10-28 06:02

History

#1 Updated by Etienne Massip over 9 years ago

  • Category set to SCM

#2 Updated by Yuichi HARADA about 1 month ago

+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

#3 Updated by Go MAEDA 21 days ago

  • Target version set to Candidate for next major release

Also available in: Atom PDF