diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index 3552c0624..8f90dd65b 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -29,7 +29,7 @@ class RepositoriesController < ApplicationController
menu_item :repository
menu_item :settings, :only => [:new, :create, :edit, :update, :destroy, :committers]
default_search_scope :changesets
-
+
before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo]
before_filter :find_repository, :only => [:edit, :update, :destroy, :committers]
before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo]
@@ -42,7 +42,7 @@ class RepositoriesController < ApplicationController
include RepositoriesHelper
helper :project_score
#@root_path = RepositoriesHelper::ROOT_PATH
-
+
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
def new
@@ -62,8 +62,8 @@ class RepositoriesController < ApplicationController
end
end
-
-
+
+
def newrepo
scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first
@repository = Repository.factory(scm)
@@ -76,23 +76,23 @@ class RepositoriesController < ApplicationController
render :layout => 'base_projects'
end
end
-
+
def fork
@repository_url = params[:repository_url]
-
+
# @repository.url
# system "htpasswd -mb "+@root_path+"user.passwd "+params[:repository][:identifier]+" "+@upasswd
# system "echo -e '"+params[:project_id]+"-"+params[:repository][:identifier]+"-write:"+
- # " "+params[:repository][:identifier]+"' >> "+@root_path+"group.passwd"
- system "git clone --bare "+@repository_url
+ # " "+params[:repository][:identifier]+"' >> "+@root_path+"group.passwd"
+ system "git clone --bare "+@repository_url
# system "mv "+@project_path+"/hooks/post-update{.sample,}"
# system "chmod a+x "+@project_path+"/hooks/post-update"
# system "."+@project_path+"/hooks/post-update"
# system "echo -e 'Allow from all \n Order Deny,Allow \n "+
- # " \n"+
- # "Require group "+params[:project_id]+"-"+params[:repository][:identifier]+"-write \n "+
- # " \n ' >>"+
- # @project_path+"/.htaccess"
+ # " \n"+
+ # "Require group "+params[:project_id]+"-"+params[:repository][:identifier]+"-write \n "+
+ # " \n ' >>"+
+ # @project_path+"/.htaccess"
flash[:notice] = l(:label_notice_fork_successed)
@repositories = @project.repositories
render :action => 'show', :layout => 'base_projects'
@@ -141,7 +141,7 @@ update
logger.info "the value of create repository"+@root_path+": "+@repository_name+": "+@project_path+": "+@repo_name
attrs = pickup_extra_info
if((@repository_tag!="")&¶ms[:repository_scm]=="Git")
- params[:repository][:url]=@project_path
+ params[:repository][:url]=@project_path
end
###xianbo
@repository = Repository.factory(params[:repository_scm])
@@ -175,7 +175,7 @@ update
end
redirect_to settings_project_url(@project, :tab => 'repositories',:repository_error_message=>@repository.errors.full_messages)
else if(@repository_tag.blank?)
- #render :action => 'newrepo', :layout =>'base_projects'
+ #render :action => 'newrepo', :layout =>'base_projects'
redirect_to settings_project_url(@project, :tab => 'repositories',:repository => "pswd_is_null",:repository_error_message=>@repository.errors.full_messages)
else
redirect_to settings_project_url(@project, :tab => 'repositories',:repository => @repository,:repository_error_message=>@repository.errors.full_messages)
@@ -185,7 +185,7 @@ update
end
end
-
+
def edit
end
@@ -230,11 +230,11 @@ update
flash[:notice] = l(:notice_successful_update)
redirect_to settings_project_url(@project, :tab => 'repositories')
elsif request.get?
- respond_to do |format|
- format.html{
- render :layout => "base_projects"
- }
- end
+ respond_to do |format|
+ format.html{
+ render :layout => "base_projects"
+ }
+ end
end
@@ -275,7 +275,7 @@ update
@entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
else
#Modified by young
- # (show_error_not_found; return) unless @entries
+ # (show_error_not_found; return) unless @entries
@changesets = @repository.latest_changesets(@path, @rev)
@properties = @repository.properties(@path, @rev)
@repositories = @project.repositories
@@ -283,7 +283,7 @@ update
project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT
ip = RepositoriesHelper::REPO_IP_ADDRESS
@repos_url = "http://"+@repository.login.to_s+"_"+@repository.identifier.to_s+"@"+ip.to_s+
- @repository.url.slice(project_path_cut, @repository.url.length).to_s
+ @repository.url.slice(project_path_cut, @repository.url.length).to_s
if @course_tag == 1
render :action => 'show', :layout => 'base_courses'
else
@@ -309,10 +309,10 @@ update
per_page_option,
params['page']
@changesets = @repository.changesets.
- limit(@changeset_pages.per_page).
- offset(@changeset_pages.offset).
- includes(:user, :repository, :parents).
- all
+ limit(@changeset_pages.per_page).
+ offset(@changeset_pages.offset).
+ includes(:user, :repository, :parents).
+ all
respond_to do |format|
format.html { render :layout => 'base_projects' }
@@ -338,8 +338,8 @@ update
@content = @repository.cat(@path, @rev)
(show_error_not_found; return) unless @content
if is_raw ||
- (@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) ||
- ! is_entry_text_data?(@content, @path)
+ (@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) ||
+ ! is_entry_text_data?(@content, @path)
# Force the download
send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) }
send_type = Redmine::MimeType.of(@path)
@@ -422,8 +422,8 @@ update
filename = "changeset_r#{@rev}"
filename << "_r#{@rev_to}" if @rev_to
send_data @diff.join, :filename => "#{filename}.diff",
- :type => 'text/x-patch',
- :disposition => 'attachment'
+ :type => 'text/x-patch',
+ :disposition => 'attachment'
else
@diff_type = params[:type] || User.current.pref[:diff_type] || 'inline'
@diff_type = 'inline' unless %w(inline sbs).include?(@diff_type)
@@ -434,7 +434,7 @@ update
User.current.preference.save
end
@cache_key = "repositories/diff/#{@repository.id}/" +
- Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}-#{current_language}")
+ Digest::MD5.hexdigest("#{@path}-#{@rev}-#{@rev_to}-#{@diff_type}-#{current_language}")
unless read_fragment(@cache_key)
@diff = @repository.diff(@path, @rev, @rev_to)
unless @diff
@@ -461,16 +461,16 @@ update
def graph
data = nil
case params[:graph]
- when "commits_per_month"
- data = graph_commits_per_month(@repository)
- when "commits_per_author"
- data = graph_commits_per_author(@repository)
- when "author_commits_per_month"
- data = graph_author_commits_per_month(@repository)
- when "author_commits_six_month"
- data = author_commits_six_month(@repository)
- when "author_code_six_months"
- data = author_code_six_month(@repository)
+ when "commits_per_month"
+ data = graph_commits_per_month(@repository)
+ when "commits_per_author"
+ data = graph_commits_per_author(@repository)
+ when "author_commits_per_month"
+ data = graph_author_commits_per_month(@repository)
+ when "author_commits_six_month"
+ data = author_commits_six_month(@repository)
+ when "author_code_six_months"
+ data = author_code_six_month(@repository)
end
if data
headers["Content-Type"] = "image/svg+xml"
@@ -550,14 +550,14 @@ update
@date_from = @date_to << 11
@date_from = Date.civil(@date_from.year, @date_from.month, 1)
commits_by_day = Changeset.count(
- :all, :group => :commit_date,
- :conditions => ["repository_id = ? AND commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
+ :all, :group => :commit_date,
+ :conditions => ["repository_id = ? AND commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
commits_by_month = [0] * 12
commits_by_day.each {|c| commits_by_month[(@date_to.month - c.first.to_date.month) % 12] += c.last }
changes_by_day = Change.count(
- :all, :group => :commit_date, :include => :changeset,
- :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
+ :all, :group => :commit_date, :include => :changeset,
+ :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
changes_by_month = [0] * 12
changes_by_day.each {|c| changes_by_month[(@date_to.month - c.first.to_date.month) % 12] += c.last }
@@ -565,26 +565,26 @@ update
12.times {|m| fields << month_name(((Date.today.month - 1 - m) % 12) + 1)}
graph = SVG::Graph::Bar.new(
- :height => 300,
- :width => 600,
- :fields => fields.reverse,
- :stack => :side,
- :scale_integers => true,
- :step_x_labels => 2,
- :show_data_values => true,
- :graph_title => l(:label_commits_per_month),
- :show_graph_title => true
+ :height => 300,
+ :width => 600,
+ :fields => fields.reverse,
+ :stack => :side,
+ :scale_integers => true,
+ :step_x_labels => 2,
+ :show_data_values => true,
+ :graph_title => l(:label_commits_per_month),
+ :show_graph_title => true
)
# 具状图
graph.add_data(
- :data => commits_by_month[0..11].reverse,
- :title => l(:label_revision_plural)
+ :data => commits_by_month[0..11].reverse,
+ :title => l(:label_revision_plural)
)
graph.add_data(
- :data => changes_by_month[0..11].reverse,
- :title => l(:label_change_plural)
+ :data => changes_by_month[0..11].reverse,
+ :title => l(:label_change_plural)
)
graph.burn
@@ -609,23 +609,23 @@ update
fields = fields.collect {|c| c.gsub(%r{<.+@.+>}, '') }
graph = SVG::Graph::BarHorizontal.new(
- :height => 400,
- :width => 600,
- :fields => fields,
- :stack => :side,
- :scale_integers => true,
- :show_data_values => true,
- :rotate_y_labels => false,
- :graph_title => l(:label_commits_per_author),
- :show_graph_title => true
+ :height => 400,
+ :width => 600,
+ :fields => fields,
+ :stack => :side,
+ :scale_integers => true,
+ :show_data_values => true,
+ :rotate_y_labels => false,
+ :graph_title => l(:label_commits_per_author),
+ :show_graph_title => true
)
graph.add_data(
- :data => commits_data,
- :title => l(:label_revision_plural)
+ :data => commits_data,
+ :title => l(:label_revision_plural)
)
graph.add_data(
- :data => changes_data,
- :title => l(:label_change_plural)
+ :data => changes_data,
+ :title => l(:label_change_plural)
)
graph.burn
end
@@ -636,7 +636,7 @@ update
@date_from = @date_to << 12
@date_from = Date.civil(@date_from.year, @date_from.month, @date_from.day)
commits_by_author = Changeset.count(:all, :group => :committer,
- :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
+ :conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(25)
fields = commits_by_author.collect {|r| r.first}