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
05255631
Commit
05255631
authored
Apr 24, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache labels at the same time we fetch them from the GH API
parent
22a33d82
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
lib/github/import.rb
lib/github/import.rb
+6
-8
No files found.
lib/github/import.rb
View file @
05255631
...
...
@@ -95,10 +95,13 @@ module Github
response
.
body
.
each
do
|
raw
|
begin
label
=
Github
::
Representation
::
Label
.
new
(
raw
)
next
if
project
.
labels
.
where
(
title:
label
.
title
).
exists?
representation
=
Github
::
Representation
::
Label
.
new
(
raw
)
project
.
labels
.
create!
(
title:
label
.
title
,
color:
label
.
color
)
label
=
project
.
labels
.
find_or_create_by!
(
title:
representation
.
title
)
do
|
label
|
label
.
color
=
representation
.
color
end
cached
[
:label_ids
][
label
.
title
]
=
label
.
id
rescue
=>
e
error
(
:label
,
label
.
url
,
e
.
message
)
end
...
...
@@ -106,11 +109,6 @@ module Github
url
=
response
.
rels
[
:next
]
end
# Cache labels
project
.
labels
.
select
(
:id
,
:title
).
find_each
do
|
label
|
cached
[
:label_ids
][
label
.
title
]
=
label
.
id
end
end
def
fetch_milestones
...
...
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