Merge branch 'develop' of 10.0.47.245:/home/trustie2 into develop
Conflicts: config/locales/zh.yml
This commit is contained in:
commit
2868d19ca0
|
@ -19,34 +19,51 @@ require 'SVG/Graph/Bar'
|
||||||
require 'SVG/Graph/BarHorizontal'
|
require 'SVG/Graph/BarHorizontal'
|
||||||
require 'digest/sha1'
|
require 'digest/sha1'
|
||||||
require 'redmine/scm/adapters/abstract_adapter'
|
require 'redmine/scm/adapters/abstract_adapter'
|
||||||
|
require 'tempfile'
|
||||||
|
|
||||||
class ChangesetNotFound < Exception; end
|
class ChangesetNotFound < Exception; end
|
||||||
class InvalidRevisionParam < Exception; end
|
class InvalidRevisionParam < Exception; end
|
||||||
|
|
||||||
class RepositoriesController < ApplicationController
|
class RepositoriesController < ApplicationController
|
||||||
layout 'base_projects'
|
|
||||||
menu_item :repository
|
menu_item :repository
|
||||||
menu_item :settings, :only => [:new, :create, :edit, :update, :destroy, :committers]
|
menu_item :settings, :only => [:new, :create, :edit, :update, :destroy, :committers]
|
||||||
default_search_scope :changesets
|
default_search_scope :changesets
|
||||||
|
|
||||||
before_filter :find_project_by_project_id, :only => [:new, :create]
|
before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo]
|
||||||
before_filter :find_repository, :only => [:edit, :update, :destroy, :committers]
|
before_filter :find_repository, :only => [:edit, :update, :destroy, :committers]
|
||||||
before_filter :find_project_repository, :except => [:new, :create, :edit, :update, :destroy, :committers]
|
before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo]
|
||||||
before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
|
before_filter :find_changeset, :only => [:revision, :add_related_issue, :remove_related_issue]
|
||||||
before_filter :authorize
|
before_filter :authorize , :except => [:newrepo,:newcreate]
|
||||||
accept_rss_auth :revisions
|
accept_rss_auth :revisions
|
||||||
|
|
||||||
|
|
||||||
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
|
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
|
||||||
|
|
||||||
def new
|
def new
|
||||||
scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first
|
scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first
|
||||||
@repository = Repository.factory(scm)
|
@repository = Repository.factory(scm)
|
||||||
@repository.is_default = @project.repository.nil?
|
@repository.is_default = @project.repository.nil?
|
||||||
@repository.project = @project
|
@repository.project = @project
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def newrepo
|
||||||
|
scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first
|
||||||
|
@repository = Repository.factory(scm)
|
||||||
|
@repository.is_default = @project.repository.nil?
|
||||||
|
@repository.project = @project
|
||||||
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
attrs = pickup_extra_info
|
attrs = pickup_extra_info
|
||||||
|
if(params[:repository]["upassword"])
|
||||||
|
params[:repository]["password"]=params[:repository]["upassword"]
|
||||||
|
if(params[:repository_scm]=="Subversion")
|
||||||
|
|
||||||
|
params[:repository]["url"]='svn://10.0.47.245/'+params[:repository]["identifier"]
|
||||||
|
end
|
||||||
|
if(params[:repository_scm]=="Git")
|
||||||
|
params[:repository]["url"]=params[:repository]["identifier"]+'@10.0.47.245://'+params[:repository]["identifier"]
|
||||||
|
end
|
||||||
|
end
|
||||||
@repository = Repository.factory(params[:repository_scm])
|
@repository = Repository.factory(params[:repository_scm])
|
||||||
@repository.safe_attributes = params[:repository]
|
@repository.safe_attributes = params[:repository]
|
||||||
if attrs[:attrs_extra].keys.any?
|
if attrs[:attrs_extra].keys.any?
|
||||||
|
@ -54,12 +71,29 @@ class RepositoriesController < ApplicationController
|
||||||
end
|
end
|
||||||
@repository.project = @project
|
@repository.project = @project
|
||||||
if request.post? && @repository.save
|
if request.post? && @repository.save
|
||||||
|
if(params[:repository]["upassword"]&¶ms[:repository_scm]=="Git")
|
||||||
|
system "htpasswd -mb /home/pdl/redmine-2.3.2-0/apache2/trustie2.passwd #{params[:repository]["identifier"]} #{params[:repository]["upassword"]}"
|
||||||
|
system "git init --bare /home/pdl/redmine-2.3.2-0/apache2/htdocs/#{params[:repository]["identifier"]}.git"
|
||||||
|
system "mv /home/pdl/redmine-2.3.2-0/apache2/htdocs/#{params[:repository]["identifier"]}.git/hooks/post-update{.sample,}"
|
||||||
|
system "./home/pdl/redmine-2.3.2-0/apache2/htdocs/#{params[:repository]["identifier"]}.git/hooks/post-update"
|
||||||
|
}
|
||||||
|
#system "C:/Users/ta/Desktop/modify.bat #{params[:repository]["identifier"]} #{params[:repository]["upassword"]}"
|
||||||
|
# system("mkdir c:/test/svn123")
|
||||||
|
# system("git init --bare c:/test/svn123/#{params[:repository]["identifier"]}")
|
||||||
|
|
||||||
|
end
|
||||||
|
if(params[:repository]["upassword"]&¶ms[:repository_scm]=="Subversion")
|
||||||
|
system("svnadmin create c:/test/#{@project}/#{params[:repository]["identifier"]}")
|
||||||
|
end
|
||||||
redirect_to settings_project_path(@project, :tab => 'repositories')
|
redirect_to settings_project_path(@project, :tab => 'repositories')
|
||||||
else
|
else if(params[:repository]["upassword"])
|
||||||
render :action => 'new'
|
render :action => 'newrepo'
|
||||||
|
else
|
||||||
|
render :action => 'new'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -370,7 +404,7 @@ class RepositoriesController < ApplicationController
|
||||||
|
|
||||||
graph = SVG::Graph::Bar.new(
|
graph = SVG::Graph::Bar.new(
|
||||||
:height => 300,
|
:height => 300,
|
||||||
:width => 650,
|
:width => 800,
|
||||||
:fields => fields.reverse,
|
:fields => fields.reverse,
|
||||||
:stack => :side,
|
:stack => :side,
|
||||||
:scale_integers => true,
|
:scale_integers => true,
|
||||||
|
@ -413,7 +447,7 @@ class RepositoriesController < ApplicationController
|
||||||
|
|
||||||
graph = SVG::Graph::BarHorizontal.new(
|
graph = SVG::Graph::BarHorizontal.new(
|
||||||
:height => 400,
|
:height => 400,
|
||||||
:width => 650,
|
:width => 800,
|
||||||
:fields => fields,
|
:fields => fields,
|
||||||
:stack => :side,
|
:stack => :side,
|
||||||
:scale_integers => true,
|
:scale_integers => true,
|
||||||
|
|
|
@ -126,7 +126,15 @@ module RepositoriesHelper
|
||||||
send(method, form, repository)
|
send(method, form, repository)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# by xianbo
|
||||||
|
def repository_field_tags_new(form, repository)
|
||||||
|
method = repository.class.name.demodulize.underscore + "_field_tags_new"
|
||||||
|
if repository.is_a?(Repository) &&
|
||||||
|
respond_to?(method) && method != 'repository_field_tags_new'
|
||||||
|
send(method, form, repository)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def scm_select_tag(repository)
|
def scm_select_tag(repository)
|
||||||
scm_options = [["--- #{l(:actionview_instancetag_blank_option)} ---", '']]
|
scm_options = [["--- #{l(:actionview_instancetag_blank_option)} ---", '']]
|
||||||
Redmine::Scm::Base.all.each do |scm|
|
Redmine::Scm::Base.all.each do |scm|
|
||||||
|
@ -154,37 +162,40 @@ module RepositoriesHelper
|
||||||
:disabled => !repository.safe_attribute?('url')) +
|
:disabled => !repository.safe_attribute?('url')) +
|
||||||
'<br />'.html_safe +
|
'<br />'.html_safe +
|
||||||
'(file:///, http://, https://, svn://, svn+[tunnelscheme]://)') +
|
'(file:///, http://, https://, svn://, svn+[tunnelscheme]://)') +
|
||||||
content_tag('p', form.text_field(:login, :size => 30)) +
|
content_tag('p', form.text_field(:login, :size => 30))+
|
||||||
content_tag('p', form.password_field(
|
content_tag('p', form.password_field(
|
||||||
:password, :size => 30, :name => 'ignore',
|
:password, :size => 30, :name => 'ignore',
|
||||||
:value => ((repository.new_record? || repository.password.blank?) ? '' : ('x'*15)),
|
:value => ((repository.new_record? || repository.password.blank?) ? '' : ('x'*15)),
|
||||||
:onfocus => "this.value=''; this.name='repository[password]';",
|
:onfocus => "this.value=''; this.name='repository[password]';",
|
||||||
:onchange => "this.name='repository[password]';"))
|
:onchange => "this.name='repository[password]';"))
|
||||||
end
|
end
|
||||||
|
# by xianbo
|
||||||
|
def subversion_field_tags_new(form, repository)
|
||||||
|
|
||||||
def darcs_field_tags(form, repository)
|
|
||||||
content_tag('p', form.text_field(
|
|
||||||
:url, :label => l(:field_path_to_repository),
|
|
||||||
:size => 60, :required => true,
|
|
||||||
:disabled => !repository.safe_attribute?('url'))) +
|
|
||||||
content_tag('p', form.select(
|
|
||||||
:log_encoding, [nil] + Setting::ENCODINGS,
|
|
||||||
:label => l(:field_commit_logs_encoding), :required => true))
|
|
||||||
end
|
end
|
||||||
|
# def darcs_field_tags(form, repository)
|
||||||
|
# content_tag('p', form.text_field(
|
||||||
|
# :url, :label => l(:field_path_to_repository),
|
||||||
|
# :size => 60, :required => true,
|
||||||
|
# :disabled => !repository.safe_attribute?('url'))) +
|
||||||
|
# content_tag('p', form.select(
|
||||||
|
# :log_encoding, [nil] + Setting::ENCODINGS,
|
||||||
|
# :label => l(:field_commit_logs_encoding), :required => true))
|
||||||
|
# end
|
||||||
|
|
||||||
def mercurial_field_tags(form, repository)
|
# def mercurial_field_tags(form, repository)
|
||||||
content_tag('p', form.text_field(
|
# content_tag('p', form.text_field(
|
||||||
:url, :label => l(:field_path_to_repository),
|
# :url, :label => l(:field_path_to_repository),
|
||||||
:size => 60, :required => true,
|
# :size => 60, :required => true,
|
||||||
:disabled => !repository.safe_attribute?('url')
|
# :disabled => !repository.safe_attribute?('url')
|
||||||
) +
|
# ) +
|
||||||
'<br />'.html_safe + l(:text_mercurial_repository_note)) +
|
# '<br />'.html_safe + l(:text_mercurial_repository_note)) +
|
||||||
content_tag('p', form.select(
|
# content_tag('p', form.select(
|
||||||
:path_encoding, [nil] + Setting::ENCODINGS,
|
# :path_encoding, [nil] + Setting::ENCODINGS,
|
||||||
:label => l(:field_scm_path_encoding)
|
# :label => l(:field_scm_path_encoding)
|
||||||
) +
|
# ) +
|
||||||
'<br />'.html_safe + l(:text_scm_path_encoding_note))
|
# '<br />'.html_safe + l(:text_scm_path_encoding_note))
|
||||||
end
|
# end
|
||||||
|
|
||||||
def git_field_tags(form, repository)
|
def git_field_tags(form, repository)
|
||||||
content_tag('p', form.text_field(
|
content_tag('p', form.text_field(
|
||||||
|
@ -204,37 +215,43 @@ module RepositoriesHelper
|
||||||
:label => l(:label_git_report_last_commit)
|
:label => l(:label_git_report_last_commit)
|
||||||
))
|
))
|
||||||
end
|
end
|
||||||
|
# by xianbo
|
||||||
def cvs_field_tags(form, repository)
|
def git_field_tags_new(form, repository)
|
||||||
content_tag('p', form.text_field(
|
content_tag('p', form.check_box(
|
||||||
:root_url,
|
:extra_report_last_commit,
|
||||||
:label => l(:field_cvsroot),
|
:label => l(:label_git_report_last_commit)
|
||||||
:size => 60, :required => true,
|
))
|
||||||
:disabled => !repository.safe_attribute?('root_url'))) +
|
|
||||||
content_tag('p', form.text_field(
|
|
||||||
:url,
|
|
||||||
:label => l(:field_cvs_module),
|
|
||||||
:size => 30, :required => true,
|
|
||||||
:disabled => !repository.safe_attribute?('url'))) +
|
|
||||||
content_tag('p', form.select(
|
|
||||||
:log_encoding, [nil] + Setting::ENCODINGS,
|
|
||||||
:label => l(:field_commit_logs_encoding), :required => true)) +
|
|
||||||
content_tag('p', form.select(
|
|
||||||
:path_encoding, [nil] + Setting::ENCODINGS,
|
|
||||||
:label => l(:field_scm_path_encoding)
|
|
||||||
) +
|
|
||||||
'<br />'.html_safe + l(:text_scm_path_encoding_note))
|
|
||||||
end
|
end
|
||||||
|
# def cvs_field_tags(form, repository)
|
||||||
|
# content_tag('p', form.text_field(
|
||||||
|
# :root_url,
|
||||||
|
# :label => l(:field_cvsroot),
|
||||||
|
# :size => 60, :required => true,
|
||||||
|
# :disabled => !repository.safe_attribute?('root_url'))) +
|
||||||
|
# content_tag('p', form.text_field(
|
||||||
|
# :url,
|
||||||
|
# :label => l(:field_cvs_module),
|
||||||
|
# :size => 30, :required => true,
|
||||||
|
# :disabled => !repository.safe_attribute?('url'))) +
|
||||||
|
# content_tag('p', form.select(
|
||||||
|
# :log_encoding, [nil] + Setting::ENCODINGS,
|
||||||
|
# :label => l(:field_commit_logs_encoding), :required => true)) +
|
||||||
|
# content_tag('p', form.select(
|
||||||
|
# :path_encoding, [nil] + Setting::ENCODINGS,
|
||||||
|
# :label => l(:field_scm_path_encoding)
|
||||||
|
# ) +
|
||||||
|
# '<br />'.html_safe + l(:text_scm_path_encoding_note))
|
||||||
|
# end
|
||||||
|
|
||||||
def bazaar_field_tags(form, repository)
|
# def bazaar_field_tags(form, repository)
|
||||||
content_tag('p', form.text_field(
|
# content_tag('p', form.text_field(
|
||||||
:url, :label => l(:field_path_to_repository),
|
# :url, :label => l(:field_path_to_repository),
|
||||||
:size => 60, :required => true,
|
# :size => 60, :required => true,
|
||||||
:disabled => !repository.safe_attribute?('url'))) +
|
# :disabled => !repository.safe_attribute?('url'))) +
|
||||||
content_tag('p', form.select(
|
# content_tag('p', form.select(
|
||||||
:log_encoding, [nil] + Setting::ENCODINGS,
|
# :log_encoding, [nil] + Setting::ENCODINGS,
|
||||||
:label => l(:field_commit_logs_encoding), :required => true))
|
# :label => l(:field_commit_logs_encoding), :required => true))
|
||||||
end
|
# end
|
||||||
|
|
||||||
def filesystem_field_tags(form, repository)
|
def filesystem_field_tags(form, repository)
|
||||||
content_tag('p', form.text_field(
|
content_tag('p', form.text_field(
|
||||||
|
@ -276,7 +293,7 @@ module RepositoriesHelper
|
||||||
space ||= index_head(0, commits.first, commits_by_scmid)
|
space ||= index_head(0, commits.first, commits_by_scmid)
|
||||||
return commits_by_scmid, space
|
return commits_by_scmid, space
|
||||||
end
|
end
|
||||||
|
|
||||||
def index_head(space, commit, commits_by_scmid)
|
def index_head(space, commit, commits_by_scmid)
|
||||||
stack = [[space, commits_by_scmid[commit.scmid]]]
|
stack = [[space, commits_by_scmid[commit.scmid]]]
|
||||||
max_space = space
|
max_space = space
|
||||||
|
@ -295,3 +312,5 @@ module RepositoriesHelper
|
||||||
max_space
|
max_space
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,3 +39,8 @@
|
||||||
<% if User.current.allowed_to?(:manage_repository, @project) %>
|
<% if User.current.allowed_to?(:manage_repository, @project) %>
|
||||||
<p><%= link_to l(:label_repository_new), new_project_repository_path(@project), :class => 'icon icon-add' %></p>
|
<p><%= link_to l(:label_repository_new), new_project_repository_path(@project), :class => 'icon icon-add' %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<!-- no repository ,new by xianbo-->
|
||||||
|
<% if User.current.allowed_to?(:manage_repository, @project) %>
|
||||||
|
<p><%= l(:label_repository_no) %>
|
||||||
|
<%= link_to l(:label_repository_new_repos), newrepo_project_repository_path(@project), :class => 'icon icon-add' %></p>
|
||||||
|
<% end %>
|
|
@ -1055,7 +1055,9 @@ zh:
|
||||||
zero: 0 问题
|
zero: 0 问题
|
||||||
one: 1 问题
|
one: 1 问题
|
||||||
other: "%{count} 问题"
|
other: "%{count} 问题"
|
||||||
label_repository_new: 新建版本库
|
label_repository_new: 配置版本库
|
||||||
|
label_repository_no: 还没有版本库?
|
||||||
|
label_repository_new_repos: 新建版本库
|
||||||
field_repository_is_default: 主版本库
|
field_repository_is_default: 主版本库
|
||||||
label_copy_attachments: 复制附件
|
label_copy_attachments: 复制附件
|
||||||
label_item_position: "%{position}/%{count}"
|
label_item_position: "%{position}/%{count}"
|
||||||
|
@ -1230,6 +1232,7 @@ zh:
|
||||||
label_in_bids: 在需求:
|
label_in_bids: 在需求:
|
||||||
label_in_users: 在用户:
|
label_in_users: 在用户:
|
||||||
label_have_respond: 进行了反馈
|
label_have_respond: 进行了反馈
|
||||||
|
label_have_respond: 进行了反馈
|
||||||
label_create_new_projects_description: 创建项目,让我们开启一次神奇的协同创作和开发之旅!
|
label_create_new_projects_description: 创建项目,让我们开启一次神奇的协同创作和开发之旅!
|
||||||
label_call_for_bids_description: 为你所想,发布需求,体验答案找上门的兴奋感觉!
|
label_call_for_bids_description: 为你所想,发布需求,体验答案找上门的兴奋感觉!
|
||||||
label_news_description: 实时了解项目的最新动态,掌握最新项目咨询!
|
label_news_description: 实时了解项目的最新动态,掌握最新项目咨询!
|
||||||
|
|
|
@ -204,7 +204,12 @@ RedmineApp::Application.routes.draw do
|
||||||
match 'committers', :via => [:get, :post]
|
match 'committers', :via => [:get, :post]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
resources :repositories, :except => [:index, :show] do
|
||||||
|
member do
|
||||||
|
get 'newrepo', :via => [:get, :post]
|
||||||
|
# get 'create', :via=>[:get, :post]
|
||||||
|
end
|
||||||
|
end
|
||||||
match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get
|
match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get
|
||||||
resources :wiki, :except => [:index, :new, :create], :as => 'wiki_page' do
|
resources :wiki, :except => [:index, :new, :create], :as => 'wiki_page' do
|
||||||
member do
|
member do
|
||||||
|
|
Loading…
Reference in New Issue