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
15044e7d
Commit
15044e7d
authored
Apr 07, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored a few things based on MR feedback
parent
e8b7e37c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
22 deletions
+25
-22
app/models/project.rb
app/models/project.rb
+13
-0
db/schema.rb
db/schema.rb
+4
-4
lib/gitlab/bitbucket_import/project_creator.rb
lib/gitlab/bitbucket_import/project_creator.rb
+1
-4
lib/gitlab/fogbugz_import/importer.rb
lib/gitlab/fogbugz_import/importer.rb
+5
-5
lib/gitlab/fogbugz_import/project_creator.rb
lib/gitlab/fogbugz_import/project_creator.rb
+1
-6
lib/gitlab/google_code_import/project_creator.rb
lib/gitlab/google_code_import/project_creator.rb
+1
-3
No files found.
app/models/project.rb
View file @
15044e7d
...
...
@@ -424,6 +424,19 @@ class Project < ActiveRecord::Base
project_import_data
.
save
end
def
create_or_update_import_data
(
credentials
)
project_import_data
=
import_data
||
build_import_data
project_import_data
.
credentials
||=
{}
project_import_data
.
credentials
=
project_import_data
.
credentials
.
merge
(
credentials
)
project_import_data
.
save
end
def
update_import_data
(
data:
nil
,
credentials:
nil
)
import_data
.
data
=
data
if
data
import_data
.
credentials
=
import_data
.
credentials
.
merge
(
credentials
)
if
credentials
import_data
.
save
end
def
import?
external_import?
||
forked?
end
...
...
db/schema.rb
View file @
15044e7d
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
201603
31223143
)
do
ActiveRecord
::
Schema
.
define
(
version:
201603
20204112
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -44,6 +44,7 @@ ActiveRecord::Schema.define(version: 20160331223143) do
t
.
datetime
"updated_at"
t
.
string
"home_page_url"
t
.
integer
"default_branch_protection"
,
default:
2
t
.
boolean
"twitter_sharing_enabled"
,
default:
true
t
.
text
"restricted_visibility_levels"
t
.
boolean
"version_check_enabled"
,
default:
true
t
.
integer
"max_attachment_size"
,
default:
10
,
null:
false
...
...
@@ -416,9 +417,9 @@ ActiveRecord::Schema.define(version: 20160331223143) do
t
.
string
"state"
t
.
integer
"iid"
t
.
integer
"updated_by_id"
t
.
boolean
"confidential"
,
default:
false
t
.
datetime
"deleted_at"
t
.
integer
"moved_to_id"
t
.
boolean
"confidential"
,
default:
false
t
.
datetime
"deleted_at"
end
add_index
"issues"
,
[
"assignee_id"
],
name:
"index_issues_on_assignee_id"
,
using: :btree
...
...
@@ -747,7 +748,6 @@ ActiveRecord::Schema.define(version: 20160331223143) do
add_index
"projects"
,
[
"namespace_id"
],
name:
"index_projects_on_namespace_id"
,
using: :btree
add_index
"projects"
,
[
"path"
],
name:
"index_projects_on_path"
,
using: :btree
add_index
"projects"
,
[
"path"
],
name:
"index_projects_on_path_trigram"
,
using: :gin
,
opclasses:
{
"path"
=>
"gin_trgm_ops"
}
add_index
"projects"
,
[
"pending_delete"
],
name:
"index_projects_on_pending_delete"
,
using: :btree
add_index
"projects"
,
[
"runners_token"
],
name:
"index_projects_on_runners_token"
,
using: :btree
add_index
"projects"
,
[
"star_count"
],
name:
"index_projects_on_star_count"
,
using: :btree
add_index
"projects"
,
[
"visibility_level"
],
name:
"index_projects_on_visibility_level"
,
using: :btree
...
...
lib/gitlab/bitbucket_import/project_creator.rb
View file @
15044e7d
...
...
@@ -23,10 +23,7 @@ module Gitlab
import_url:
"ssh://git@bitbucket.org/
#{
repo
[
"owner"
]
}
/
#{
repo
[
"slug"
]
}
.git"
,
).
execute
import_data
=
project
.
import_data
# merge! with a bang doesn't work here
import_data
.
credentials
=
import_data
.
credentials
.
merge
(
bb_session:
session_data
)
import_data
.
save
project
.
update_import_data
(
credentials:
{
bb_session:
session_data
})
project
end
...
...
lib/gitlab/fogbugz_import/importer.rb
View file @
15044e7d
...
...
@@ -18,7 +18,7 @@ module Gitlab
def
execute
return
true
unless
repo
.
valid?
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:
fb_session
[
:token
],
uri:
fb_session
[
:uri
])
@cases
=
client
.
cases
(
@repo
.
id
.
to_i
)
@categories
=
client
.
categories
...
...
@@ -30,8 +30,8 @@ module Gitlab
private
def
import_data_credentials
@import_data_credentials
||=
project
.
import_data
.
credentials
if
project
.
import_data
def
fb_session
@import_data_credentials
||=
project
.
import_data
.
credentials
[
:fb_session
]
if
project
.
import_data
&&
project
.
import_data
.
credentials
end
def
user_map
...
...
@@ -240,8 +240,8 @@ module Gitlab
end
def
build_attachment_url
(
rel_url
)
uri
=
import_data_credentials
[
:fb_session
]
[
:uri
]
token
=
import_data_credentials
[
:fb_session
]
[
:token
]
uri
=
fb_session
[
:uri
]
token
=
fb_session
[
:token
]
"
#{
uri
}
/
#{
rel_url
}
&token=
#{
token
}
"
end
...
...
lib/gitlab/fogbugz_import/project_creator.rb
View file @
15044e7d
...
...
@@ -24,12 +24,7 @@ module Gitlab
import_url:
Project
::
UNKNOWN_IMPORT_URL
).
execute
import_data
=
project
.
import_data
import_data
.
data
=
{
'repo'
=>
repo
.
raw_data
,
'user_map'
=>
user_map
}
# merge! with a bang doesn't work here
import_data
.
credentials
=
import_data
.
credentials
.
merge
(
fb_session:
fb_session
)
import_data
.
save
project
.
update_import_data
(
data:
{
'repo'
=>
repo
.
raw_data
,
'user_map'
=>
user_map
},
credentials:
{
fb_session:
fb_session
})
project
end
...
...
lib/gitlab/google_code_import/project_creator.rb
View file @
15044e7d
...
...
@@ -24,9 +24,7 @@ module Gitlab
import_url:
repo
.
import_url
).
execute
import_data
=
project
.
import_data
import_data
.
data
=
{
'repo'
=>
repo
.
raw_data
,
'user_map'
=>
user_map
}
import_data
.
save
project
.
update_import_data
(
data:
{
'repo'
=>
repo
.
raw_data
,
'user_map'
=>
user_map
})
project
end
...
...
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