Commit 8a9c8156 authored by Douwe Maan's avatar Douwe Maan

Add "Mirror repository" checkbox to new project form.

parent afeb32eb
...@@ -8,9 +8,7 @@ class Projects::ImportsController < Projects::ApplicationController ...@@ -8,9 +8,7 @@ class Projects::ImportsController < Projects::ApplicationController
end end
def create def create
@project.import_url = params[:project][:import_url] if @project.update_attributes(import_params)
if @project.save
@project.reload @project.reload
if @project.import_failed? if @project.import_failed?
...@@ -48,4 +46,8 @@ class Projects::ImportsController < Projects::ApplicationController ...@@ -48,4 +46,8 @@ class Projects::ImportsController < Projects::ApplicationController
return return
end end
end end
def import_params
params.require(:project).permit(:import_url, :mirror)
end
end end
...@@ -216,6 +216,7 @@ class ProjectsController < ApplicationController ...@@ -216,6 +216,7 @@ class ProjectsController < ApplicationController
:issues_enabled, :merge_requests_enabled, :snippets_enabled, :issues_tracker_id, :default_branch, :issues_enabled, :merge_requests_enabled, :snippets_enabled, :issues_tracker_id, :default_branch,
:wiki_enabled, :issues_template, :merge_requests_template, :visibility_level, :merge_requests_rebase_enabled, :wiki_enabled, :issues_template, :merge_requests_template, :visibility_level, :merge_requests_rebase_enabled,
:import_url, :last_activity_at, :namespace_id, :avatar, :import_url, :last_activity_at, :namespace_id, :avatar,
:mirror,
:approvals_before_merge, :approver_ids, :reset_approvals_on_push, :merge_requests_ff_only_enabled :approvals_before_merge, :approver_ids, :reset_approvals_on_push, :merge_requests_ff_only_enabled
) )
end end
...@@ -245,7 +246,7 @@ class ProjectsController < ApplicationController ...@@ -245,7 +246,7 @@ class ProjectsController < ApplicationController
project.repository_exists? && !project.empty_repo? project.repository_exists? && !project.empty_repo?
end end
# Override get_id from ExtractsPath, which returns the branch and file path # Override get_id from ExtractsPath, which returns the branch and file path
# for the blob/tree, which in this case is just the root of the default branch. # for the blob/tree, which in this case is just the root of the default branch.
def get_id def get_id
project.repository.root_ref project.repository.root_ref
......
...@@ -14,3 +14,13 @@ ...@@ -14,3 +14,13 @@
The import will time out after 4 minutes. For big repositories, use a clone/push combination. The import will time out after 4 minutes. For big repositories, use a clone/push combination.
%li %li
To migrate an SVN repository, check out #{link_to "this document", "http://doc.gitlab.com/ce/workflow/importing/migrating_from_svn.html"}. To migrate an SVN repository, check out #{link_to "this document", "http://doc.gitlab.com/ce/workflow/importing/migrating_from_svn.html"}.
.form-group
.col-sm-offset-2.col-sm-10
.checkbox
= f.label :mirror do
= f.check_box :mirror
%strong
Mirror repository
.help-block
Automatically update this project's branches and tags from the upstream repository every hour.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment