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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
737f322e
Commit
737f322e
authored
Mar 31, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import GitHub, Bitbucket or GitLab.com projects owned by authenticated user into current namespace.
parent
33a8f53f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
3 deletions
+17
-3
CHANGELOG
CHANGELOG
+1
-0
app/controllers/import/bitbucket_controller.rb
app/controllers/import/bitbucket_controller.rb
+4
-1
app/controllers/import/github_controller.rb
app/controllers/import/github_controller.rb
+4
-1
app/controllers/import/gitlab_controller.rb
app/controllers/import/gitlab_controller.rb
+4
-1
lib/gitlab/gitlab_import/client.rb
lib/gitlab/gitlab_import/client.rb
+4
-0
No files found.
CHANGELOG
View file @
737f322e
...
@@ -48,6 +48,7 @@ v 7.10.0 (unreleased)
...
@@ -48,6 +48,7 @@ v 7.10.0 (unreleased)
- Prevent note form from being cleared when submitting failed.
- Prevent note form from being cleared when submitting failed.
- Improve file icons rendering on tree (Sullivan Sénéchal)
- Improve file icons rendering on tree (Sullivan Sénéchal)
- API: Add pagination to project events
- API: Add pagination to project events
- Import GitHub, Bitbucket or GitLab.com projects owned by authenticated user into current namespace.
v 7.9.0
v 7.9.0
- Send EmailsOnPush email when branch or tag is created or deleted.
- Send EmailsOnPush email when branch or tag is created or deleted.
...
...
app/controllers/import/bitbucket_controller.rb
View file @
737f322e
...
@@ -36,8 +36,11 @@ class Import::BitbucketController < Import::BaseController
...
@@ -36,8 +36,11 @@ class Import::BitbucketController < Import::BaseController
def
create
def
create
@repo_id
=
params
[
:repo_id
]
||
""
@repo_id
=
params
[
:repo_id
]
||
""
repo
=
client
.
project
(
@repo_id
.
gsub
(
"___"
,
"/"
))
repo
=
client
.
project
(
@repo_id
.
gsub
(
"___"
,
"/"
))
@target_namespace
=
params
[
:new_namespace
].
presence
||
repo
[
"owner"
]
@project_name
=
repo
[
"slug"
]
@project_name
=
repo
[
"slug"
]
repo_owner
=
repo
[
"owner"
]
repo_owner
=
current_user
.
username
if
repo_owner
==
client
.
user
[
"user"
][
"username"
]
@target_namespace
=
params
[
:new_namespace
].
presence
||
repo_owner
namespace
=
get_or_create_namespace
||
(
render
and
return
)
namespace
=
get_or_create_namespace
||
(
render
and
return
)
...
...
app/controllers/import/github_controller.rb
View file @
737f322e
...
@@ -31,8 +31,11 @@ class Import::GithubController < Import::BaseController
...
@@ -31,8 +31,11 @@ class Import::GithubController < Import::BaseController
def
create
def
create
@repo_id
=
params
[
:repo_id
].
to_i
@repo_id
=
params
[
:repo_id
].
to_i
repo
=
client
.
repo
(
@repo_id
)
repo
=
client
.
repo
(
@repo_id
)
@target_namespace
=
params
[
:new_namespace
].
presence
||
repo
.
owner
.
login
@project_name
=
repo
.
name
@project_name
=
repo
.
name
repo_owner
=
repo
.
owner
.
login
repo_owner
=
current_user
.
username
if
repo_owner
==
client
.
user
.
login
@target_namespace
=
params
[
:new_namespace
].
presence
||
repo_owner
namespace
=
get_or_create_namespace
||
(
render
and
return
)
namespace
=
get_or_create_namespace
||
(
render
and
return
)
...
...
app/controllers/import/gitlab_controller.rb
View file @
737f322e
...
@@ -28,8 +28,11 @@ class Import::GitlabController < Import::BaseController
...
@@ -28,8 +28,11 @@ class Import::GitlabController < Import::BaseController
def
create
def
create
@repo_id
=
params
[
:repo_id
].
to_i
@repo_id
=
params
[
:repo_id
].
to_i
repo
=
client
.
project
(
@repo_id
)
repo
=
client
.
project
(
@repo_id
)
@target_namespace
=
params
[
:new_namespace
].
presence
||
repo
[
"namespace"
][
"path"
]
@project_name
=
repo
[
"name"
]
@project_name
=
repo
[
"name"
]
repo_owner
=
repo
[
"namespace"
][
"path"
]
repo_owner
=
current_user
.
username
if
repo_owner
==
client
.
user
[
"username"
]
@target_namespace
=
params
[
:new_namespace
].
presence
||
repo_owner
namespace
=
get_or_create_namespace
||
(
render
and
return
)
namespace
=
get_or_create_namespace
||
(
render
and
return
)
...
...
lib/gitlab/gitlab_import/client.rb
View file @
737f322e
...
@@ -28,6 +28,10 @@ module Gitlab
...
@@ -28,6 +28,10 @@ module Gitlab
client
.
auth_code
.
get_token
(
code
,
redirect_uri:
redirect_uri
).
token
client
.
auth_code
.
get_token
(
code
,
redirect_uri:
redirect_uri
).
token
end
end
def
user
api
.
get
(
"/api/v3/user"
).
parsed
end
def
issues
(
project_identifier
)
def
issues
(
project_identifier
)
lazy_page_iterator
(
PER_PAGE
)
do
|
page
|
lazy_page_iterator
(
PER_PAGE
)
do
|
page
|
api
.
get
(
"/api/v3/projects/
#{
project_identifier
}
/issues?per_page=
#{
PER_PAGE
}
&page=
#{
page
}
"
).
parsed
api
.
get
(
"/api/v3/projects/
#{
project_identifier
}
/issues?per_page=
#{
PER_PAGE
}
&page=
#{
page
}
"
).
parsed
...
...
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