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
Jérome Perrin
gitlab-ce
Commits
b07dc938
Commit
b07dc938
authored
Jun 13, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed specs and refactored a few things due to recent model changes and merge conflicts
parent
ad68bc63
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
158 additions
and
314 deletions
+158
-314
app/models/commit_status.rb
app/models/commit_status.rb
+2
-1
app/models/note.rb
app/models/note.rb
+3
-2
lib/gitlab/import_export/relation_factory.rb
lib/gitlab/import_export/relation_factory.rb
+2
-2
lib/gitlab/import_export/uploads_restorer.rb
lib/gitlab/import_export/uploads_restorer.rb
+1
-6
spec/lib/gitlab/import_export/project.json
spec/lib/gitlab/import_export/project.json
+150
-303
No files found.
app/models/commit_status.rb
View file @
b07dc938
class
CommitStatus
<
ActiveRecord
::
Base
include
Statuseable
include
Importable
self
.
table_name
=
'ci_builds'
...
...
@@ -7,7 +8,7 @@ class CommitStatus < ActiveRecord::Base
belongs_to
:pipeline
,
class_name:
'Ci::Pipeline'
,
foreign_key: :commit_id
,
touch:
true
belongs_to
:user
validates
:pipeline
,
presence:
true
validates
:pipeline
,
presence:
true
,
unless: :importing?
validates_presence_of
:name
...
...
app/models/note.rb
View file @
b07dc938
...
...
@@ -4,6 +4,7 @@ class Note < ActiveRecord::Base
include
Participable
include
Mentionable
include
Awardable
include
Importable
default_value_for
:system
,
false
...
...
@@ -28,11 +29,11 @@ class Note < ActiveRecord::Base
validates
:attachment
,
file_size:
{
maximum: :max_attachment_size
}
validates
:noteable_type
,
presence:
true
validates
:noteable_id
,
presence:
true
,
unless:
:for_commit?
validates
:noteable_id
,
presence:
true
,
unless:
[
:for_commit?
,
:importing?
]
validates
:commit_id
,
presence:
true
,
if: :for_commit?
validates
:author
,
presence:
true
validate
unless:
:for_commit?
do
|
note
|
validate
unless:
[
:for_commit?
,
:importing?
]
do
|
note
|
unless
note
.
noteable
.
try
(
:project
)
==
note
.
project
errors
.
add
(
:invalid_project
,
'Note and noteable project mismatch'
)
end
...
...
lib/gitlab/import_export/relation_factory.rb
View file @
b07dc938
...
...
@@ -3,7 +3,7 @@ module Gitlab
class
RelationFactory
OVERRIDES
=
{
snippets: :project_snippets
,
ci_commits:
'Ci::Commit
'
,
pipelines:
'Ci::Pipeline
'
,
statuses:
'commit_status'
,
variables:
'Ci::Variable'
,
triggers:
'Ci::Trigger'
,
...
...
@@ -18,7 +18,7 @@ module Gitlab
def
initialize
(
relation_sym
:,
relation_hash
:,
members_mapper
:,
user_admin
:)
@relation_name
=
OVERRIDES
[
relation_sym
]
||
relation_sym
@relation_hash
=
relation_hash
.
except
(
'id'
)
@relation_hash
=
relation_hash
.
except
(
'id'
,
'noteable_id'
)
@members_mapper
=
members_mapper
@user_admin
=
user_admin
end
...
...
lib/gitlab/import_export/uploads_restorer.rb
View file @
b07dc938
module
Gitlab
module
ImportExport
class
UploadsRestorer
<
UploadsSaver
class
<<
self
alias_method
:restore
,
:save
end
def
save
def
restore
return
true
unless
File
.
directory?
(
uploads_export_path
)
copy_files
(
uploads_export_path
,
uploads_path
)
...
...
spec/lib/gitlab/import_export/project.json
View file @
b07dc938
This diff is collapsed.
Click to expand it.
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