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
d082b789
Commit
d082b789
authored
Apr 25, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add basic progress output to GitHub import
parent
f184cb43
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
lib/github/import.rb
lib/github/import.rb
+10
-1
lib/tasks/import.rake
lib/tasks/import.rake
+2
-2
No files found.
lib/github/import.rb
View file @
d082b789
...
@@ -38,24 +38,33 @@ module Github
...
@@ -38,24 +38,33 @@ module Github
self
.
reset_callbacks
:validate
self
.
reset_callbacks
:validate
end
end
attr_reader
:project
,
:repository
,
:repo
,
:options
,
:errors
,
:cached
attr_reader
:project
,
:repository
,
:repo
,
:options
,
:errors
,
:cached
,
:verbose
def
initialize
(
project
,
options
)
def
initialize
(
project
,
options
)
@project
=
project
@project
=
project
@repository
=
project
.
repository
@repository
=
project
.
repository
@repo
=
project
.
import_source
@repo
=
project
.
import_source
@options
=
options
@options
=
options
@verbose
=
options
.
fetch
(
:verbose
,
false
)
@cached
=
Hash
.
new
{
|
hash
,
key
|
hash
[
key
]
=
Hash
.
new
}
@cached
=
Hash
.
new
{
|
hash
,
key
|
hash
[
key
]
=
Hash
.
new
}
@errors
=
[]
@errors
=
[]
end
end
# rubocop: disable Rails/Output
def
execute
def
execute
puts
'Fetching repository...'
.
color
(
:aqua
)
if
verbose
fetch_repository
fetch_repository
puts
'Fetching labels...'
.
color
(
:aqua
)
if
verbose
fetch_labels
fetch_labels
puts
'Fetching milestones...'
.
color
(
:aqua
)
if
verbose
fetch_milestones
fetch_milestones
puts
'Fetching pull requests...'
.
color
(
:aqua
)
if
verbose
fetch_pull_requests
fetch_pull_requests
puts
'Fetching issues...'
.
color
(
:aqua
)
if
verbose
fetch_issues
fetch_issues
puts
'Cloning wiki repository...'
.
color
(
:aqua
)
if
verbose
fetch_wiki_repository
fetch_wiki_repository
puts
'Expiring repository cache...'
.
color
(
:aqua
)
if
verbose
expire_repository_cache
expire_repository_cache
true
true
...
...
lib/tasks/import.rake
View file @
d082b789
...
@@ -7,7 +7,7 @@ class GithubImport
...
@@ -7,7 +7,7 @@ class GithubImport
end
end
def
initialize
(
token
,
gitlab_username
,
project_path
,
extras
)
def
initialize
(
token
,
gitlab_username
,
project_path
,
extras
)
@options
=
{
url:
'https://api.github.com'
,
token:
token
}
@options
=
{
url:
'https://api.github.com'
,
token:
token
,
verbose:
true
}
@project_path
=
project_path
@project_path
=
project_path
@current_user
=
User
.
find_by_username
(
gitlab_username
)
@current_user
=
User
.
find_by_username
(
gitlab_username
)
@github_repo
=
extras
.
empty?
?
nil
:
extras
.
first
@github_repo
=
extras
.
empty?
?
nil
:
extras
.
first
...
@@ -28,7 +28,7 @@ class GithubImport
...
@@ -28,7 +28,7 @@ class GithubImport
private
private
def
show_warning!
def
show_warning!
puts
"This will import G
H
#{
@repo
[
'full_name'
].
bright
}
into GL
#{
@project_path
.
bright
}
as
#{
@current_user
.
name
}
"
puts
"This will import G
itHub
#{
@repo
[
'full_name'
].
bright
}
into GitLab
#{
@project_path
.
bright
}
as
#{
@current_user
.
name
}
"
puts
"Permission checks are ignored. Press any key to continue."
.
color
(
:red
)
puts
"Permission checks are ignored. Press any key to continue."
.
color
(
:red
)
STDIN
.
getch
STDIN
.
getch
...
...
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