Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
478730be
Commit
478730be
authored
Nov 11, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support selection of different namespace and project destination
parent
a0959430
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
app/controllers/import/bitbucket_controller.rb
app/controllers/import/bitbucket_controller.rb
+3
-3
app/views/import/bitbucket/status.html.haml
app/views/import/bitbucket/status.html.haml
+12
-2
No files found.
app/controllers/import/bitbucket_controller.rb
View file @
478730be
...
...
@@ -39,9 +39,9 @@ class Import::BitbucketController < Import::BaseController
client
=
Bitbucket
::
Client
.
new
(
credentials
)
@repo_id
=
params
[
:repo_id
].
to_s
name
=
@repo_id
.
to_s
.
gsub
(
'___'
,
'/'
)
name
=
@repo_id
.
gsub
(
'___'
,
'/'
)
repo
=
client
.
repo
(
name
)
@project_name
=
repo
.
name
@project_name
=
params
[
:new_name
].
presence
||
repo
.
name
repo_owner
=
repo
.
owner
repo_owner
=
current_user
.
username
if
repo_owner
==
client
.
user
.
username
...
...
@@ -50,7 +50,7 @@ class Import::BitbucketController < Import::BaseController
namespace
=
find_or_create_namespace
(
@target_namespace
,
repo_owner
)
if
current_user
.
can?
(
:create_projects
,
namespace
)
@project
=
Gitlab
::
BitbucketImport
::
ProjectCreator
.
new
(
repo
,
namespace
,
current_user
,
credentials
).
execute
@project
=
Gitlab
::
BitbucketImport
::
ProjectCreator
.
new
(
repo
,
@project_name
,
namespace
,
current_user
,
credentials
).
execute
else
render
'unauthorized'
end
...
...
app/views/import/bitbucket/status.html.haml
View file @
478730be
...
...
@@ -15,7 +15,7 @@
Import all compatible projects
=
icon
(
'spinner spin'
,
class:
'loading-icon'
)
-
else
=
button_tag
class:
'btn btn-success js-import-all'
do
=
button_tag
class:
'btn btn-
import btn-
success js-import-all'
do
Import all projects
=
icon
(
'spinner spin'
,
class:
'loading-icon'
)
...
...
@@ -52,7 +52,17 @@
%td
=
link_to
"
#{
repo
.
full_name
}
"
,
"https://bitbucket.org/
#{
repo
.
full_name
}
"
,
target:
"_blank"
%td
.import-target
=
"
#{
repo
.
full_name
}
"
%fieldset
.row
.input-group
.project-path.input-group-btn
-
if
current_user
.
can_select_namespace?
-
selected
=
params
[
:namespace_id
]
||
:current_user
-
opts
=
current_user
.
can_create_group?
?
{
extra_group:
Group
.
new
(
name:
repo
.
owner
,
path:
repo
.
owner
)
}
:
{}
=
select_tag
:namespace_id
,
namespaces_options
(
selected
,
opts
.
merge
({
display_path:
true
})),
{
class:
'select2 js-select-namespace'
,
tabindex:
1
}
-
else
=
text_field_tag
:path
,
current_user
.
namespace_path
,
class:
"input-large form-control"
,
tabindex:
1
,
disabled:
true
%span
.input-group-addon
/
=
text_field_tag
:path
,
repo
.
name
,
class:
"input-mini form-control"
,
tabindex:
2
,
autofocus:
true
,
required:
true
%td
.import-actions.job-status
=
button_tag
class:
'btn btn-import js-add-to-import'
do
Import
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment