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
3d2a7366
Commit
3d2a7366
authored
Jun 29, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing events for import/export
parent
9e8fdead
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
34 additions
and
7 deletions
+34
-7
app/models/concerns/eventable.rb
app/models/concerns/eventable.rb
+15
-0
app/models/issue.rb
app/models/issue.rb
+1
-0
app/models/merge_request.rb
app/models/merge_request.rb
+1
-0
app/models/milestone.rb
app/models/milestone.rb
+1
-0
app/models/note.rb
app/models/note.rb
+1
-0
lib/gitlab/import_export/import_export.yml
lib/gitlab/import_export/import_export.yml
+10
-5
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
+5
-2
No files found.
app/models/concerns/eventable.rb
0 → 100644
View file @
3d2a7366
module
Eventable
extend
ActiveSupport
::
Concern
def
events
Event
.
where
(
target_id:
id
,
target_type:
self
.
class
.
to_s
)
end
def
events
=
(
events
)
events
.
each
do
|
event
|
event
.
target_id
=
id
event
.
data
.
deep_symbolize_keys!
event
.
save!
end
end
end
\ No newline at end of file
app/models/issue.rb
View file @
3d2a7366
...
@@ -6,6 +6,7 @@ class Issue < ActiveRecord::Base
...
@@ -6,6 +6,7 @@ class Issue < ActiveRecord::Base
include
Referable
include
Referable
include
Sortable
include
Sortable
include
Taskable
include
Taskable
include
Eventable
DueDateStruct
=
Struct
.
new
(
:title
,
:name
).
freeze
DueDateStruct
=
Struct
.
new
(
:title
,
:name
).
freeze
NoDueDate
=
DueDateStruct
.
new
(
'No Due Date'
,
'0'
).
freeze
NoDueDate
=
DueDateStruct
.
new
(
'No Due Date'
,
'0'
).
freeze
...
...
app/models/merge_request.rb
View file @
3d2a7366
...
@@ -5,6 +5,7 @@ class MergeRequest < ActiveRecord::Base
...
@@ -5,6 +5,7 @@ class MergeRequest < ActiveRecord::Base
include
Sortable
include
Sortable
include
Taskable
include
Taskable
include
Importable
include
Importable
include
Eventable
belongs_to
:target_project
,
foreign_key: :target_project_id
,
class_name:
"Project"
belongs_to
:target_project
,
foreign_key: :target_project_id
,
class_name:
"Project"
belongs_to
:source_project
,
foreign_key: :source_project_id
,
class_name:
"Project"
belongs_to
:source_project
,
foreign_key: :source_project_id
,
class_name:
"Project"
...
...
app/models/milestone.rb
View file @
3d2a7366
...
@@ -11,6 +11,7 @@ class Milestone < ActiveRecord::Base
...
@@ -11,6 +11,7 @@ class Milestone < ActiveRecord::Base
include
Referable
include
Referable
include
StripAttribute
include
StripAttribute
include
Milestoneish
include
Milestoneish
include
Eventable
belongs_to
:project
belongs_to
:project
has_many
:issues
has_many
:issues
...
...
app/models/note.rb
View file @
3d2a7366
...
@@ -5,6 +5,7 @@ class Note < ActiveRecord::Base
...
@@ -5,6 +5,7 @@ class Note < ActiveRecord::Base
include
Mentionable
include
Mentionable
include
Awardable
include
Awardable
include
Importable
include
Importable
include
Eventable
# Attribute containing rendered and redacted Markdown as generated by
# Attribute containing rendered and redacted Markdown as generated by
# Banzai::ObjectRenderer.
# Banzai::ObjectRenderer.
...
...
lib/gitlab/import_export/import_export.yml
View file @
3d2a7366
# Model relationships to be included in the project import/export
# Model relationships to be included in the project import/export
project_tree
:
project_tree
:
-
issues
:
-
issues
:
-
:events
-
notes
:
-
notes
:
:author
-
:author
-
:events
-
:labels
-
:labels
-
:milestones
-
milestones
:
-
:events
-
snippets
:
-
snippets
:
-
notes
:
-
notes
:
:author
:author
-
:releases
-
:releases
-
:events
-
project_members
:
-
project_members
:
-
:user
-
:user
-
merge_requests
:
-
merge_requests
:
-
notes
:
-
notes
:
:author
-
:author
-
:events
-
:merge_request_diff
-
:merge_request_diff
-
:events
-
pipelines
:
-
pipelines
:
-
notes
:
-
notes
:
:author
-
:author
-
:events
-
:statuses
-
:statuses
-
:variables
-
:variables
-
:triggers
-
:triggers
...
...
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
View file @
3d2a7366
...
@@ -34,7 +34,7 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
...
@@ -34,7 +34,7 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
end
end
it
'has events'
do
it
'has events'
do
expect
(
saved_project_json
[
'events'
]).
not_to
be_empty
expect
(
saved_project_json
[
'
milestones'
].
first
[
'
events'
]).
not_to
be_empty
end
end
it
'has milestones'
do
it
'has milestones'
do
...
@@ -132,7 +132,7 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
...
@@ -132,7 +132,7 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
statuses:
[
commit_status
])
statuses:
[
commit_status
])
create
(
:ci_build
,
pipeline:
ci_pipeline
,
project:
project
)
create
(
:ci_build
,
pipeline:
ci_pipeline
,
project:
project
)
create
(
:milestone
,
project:
project
)
milestone
=
create
(
:milestone
,
project:
project
)
create
(
:note
,
noteable:
issue
,
project:
project
)
create
(
:note
,
noteable:
issue
,
project:
project
)
create
(
:note
,
noteable:
merge_request
,
project:
project
)
create
(
:note
,
noteable:
merge_request
,
project:
project
)
create
(
:note
,
noteable:
snippet
,
project:
project
)
create
(
:note
,
noteable:
snippet
,
project:
project
)
...
@@ -140,6 +140,9 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
...
@@ -140,6 +140,9 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
author:
user
,
author:
user
,
project:
project
,
project:
project
,
commit_id:
ci_pipeline
.
sha
)
commit_id:
ci_pipeline
.
sha
)
create
(
:event
,
target:
milestone
,
project:
project
,
action:
Event
::
CREATED
,
author:
user
)
project
project
end
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