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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
6d12d79d
Commit
6d12d79d
authored
Apr 01, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix fogbugz import
parent
075b56aa
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
9 deletions
+12
-9
app/models/project_import_data.rb
app/models/project_import_data.rb
+4
-0
lib/gitlab/fogbugz_import/importer.rb
lib/gitlab/fogbugz_import/importer.rb
+6
-8
lib/gitlab/fogbugz_import/project_creator.rb
lib/gitlab/fogbugz_import/project_creator.rb
+2
-1
No files found.
app/models/project_import_data.rb
View file @
6d12d79d
...
@@ -17,4 +17,8 @@ class ProjectImportData < ActiveRecord::Base
...
@@ -17,4 +17,8 @@ class ProjectImportData < ActiveRecord::Base
serialize
:data
,
JSON
serialize
:data
,
JSON
validates
:project
,
presence:
true
validates
:project
,
presence:
true
def
stringified_credentials
JSON
[
credentials
.
to_json
]
end
end
end
lib/gitlab/fogbugz_import/importer.rb
View file @
6d12d79d
...
@@ -8,7 +8,7 @@ module Gitlab
...
@@ -8,7 +8,7 @@ module Gitlab
import_data
=
project
.
import_data
.
try
(
:data
)
import_data
=
project
.
import_data
.
try
(
:data
)
repo_data
=
import_data
[
'repo'
]
if
import_data
repo_data
=
import_data
[
'repo'
]
if
import_data
if
import_data_credentials
&&
import_data_credentials
[
'repo'
]
if
defined?
(
repo_data
)
@repo
=
FogbugzImport
::
Repository
.
new
(
repo_data
)
@repo
=
FogbugzImport
::
Repository
.
new
(
repo_data
)
@known_labels
=
Set
.
new
@known_labels
=
Set
.
new
else
else
...
@@ -18,10 +18,8 @@ module Gitlab
...
@@ -18,10 +18,8 @@ module Gitlab
def
execute
def
execute
return
true
unless
repo
.
valid?
return
true
unless
repo
.
valid?
Rails
.
logger
.
error
import_data_credentials
.
inspect
data
=
project
.
import_data
.
try
(
:data
)
client
=
Gitlab
::
FogbugzImport
::
Client
.
new
(
token:
import_data_credentials
[
'fb_session'
][
'token'
],
uri:
import_data_credentials
[
'fb_session'
][
'uri'
])
client
=
Gitlab
::
FogbugzImport
::
Client
.
new
(
token:
data
[
'fb_session'
][
'token'
],
uri:
data
[
'fb_session'
][
'uri'
])
@cases
=
client
.
cases
(
@repo
.
id
.
to_i
)
@cases
=
client
.
cases
(
@repo
.
id
.
to_i
)
@categories
=
client
.
categories
@categories
=
client
.
categories
...
@@ -34,7 +32,7 @@ module Gitlab
...
@@ -34,7 +32,7 @@ module Gitlab
private
private
def
import_data_credentials
def
import_data_credentials
@import_data_credentials
||=
project
.
import_data
.
credentials
if
project
.
import_data
@import_data_credentials
||=
project
.
import_data
.
stringified_
credentials
if
project
.
import_data
end
end
def
user_map
def
user_map
...
@@ -244,8 +242,8 @@ module Gitlab
...
@@ -244,8 +242,8 @@ module Gitlab
def
build_attachment_url
(
rel_url
)
def
build_attachment_url
(
rel_url
)
data
=
project
.
import_data
.
try
(
:data
)
data
=
project
.
import_data
.
try
(
:data
)
uri
=
data
[
'fb_session'
][
'uri'
]
uri
=
import_data_credentials
[
'fb_session'
][
'uri'
]
token
=
data
[
'fb_session'
][
'token'
]
token
=
import_data_credentials
[
'fb_session'
][
'token'
]
"
#{
uri
}
/
#{
rel_url
}
&token=
#{
token
}
"
"
#{
uri
}
/
#{
rel_url
}
&token=
#{
token
}
"
end
end
...
...
lib/gitlab/fogbugz_import/project_creator.rb
View file @
6d12d79d
...
@@ -25,9 +25,10 @@ module Gitlab
...
@@ -25,9 +25,10 @@ module Gitlab
).
execute
).
execute
import_data
=
project
.
import_data
import_data
=
project
.
import_data
import_data
.
data
=
{
'repo'
=>
repo
.
raw_data
,
'user_map'
=>
user_map
}
# merge! with a bang doesn't work here
# merge! with a bang doesn't work here
import_data
.
credentials
=
import_data
.
credentials
.
merge
(
'fb_session'
=>
fb_session
)
import_data
.
credentials
=
import_data
.
credentials
.
merge
(
'fb_session'
=>
fb_session
)
import_data
.
data
=
{
'repo'
=>
repo
.
raw_data
,
'user_map'
=>
user_map
}
import_data
.
save
import_data
.
save
project
project
...
...
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