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
3b99e4ae
Commit
3b99e4ae
authored
Apr 12, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add issue and MR comments to default export. Fix spec
parent
5d642fb7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
166 deletions
+19
-166
app/services/projects/import_export/import_export.yml
app/services/projects/import_export/import_export.yml
+3
-1
app/services/projects/import_export/import_export_reader.rb
app/services/projects/import_export/import_export_reader.rb
+4
-4
app/services/projects/import_export/project_tree_saver.rb
app/services/projects/import_export/project_tree_saver.rb
+0
-2
spec/services/projects/import_export/project_tree_saver_spec.rb
...ervices/projects/import_export/project_tree_saver_spec.rb
+12
-159
No files found.
app/services/projects/import_export/import_export.yml
View file @
3b99e4ae
# Class relationships to be included in the project import/export
:project_tree:
- :issues
- :issues:
- :notes
- :labels
- :milestones
- :snippets
...
...
@@ -10,6 +11,7 @@
- :user
- :merge_requests:
- :merge_request_diff
- :notes
- :commit_statuses:
- :commit
...
...
app/services/projects/import_export/import_export_reader.rb
View file @
3b99e4ae
...
...
@@ -7,6 +7,10 @@ module Projects
{
only:
atts_only
[
:project
],
include:
build_hash
(
tree
)
}
end
def
tree
config
[
:project_tree
]
end
private
def
config
...
...
@@ -21,10 +25,6 @@ module Projects
config
[
:attributes_except
]
end
def
tree
config
[
:project_tree
]
end
def
build_hash
(
array
)
array
.
map
do
|
el
|
if
el
.
is_a?
(
Hash
)
...
...
app/services/projects/import_export/project_tree_saver.rb
View file @
3b99e4ae
...
...
@@ -30,8 +30,6 @@ module Projects
end
def
project_json_tree
# TODO confirm children, also add subchildren (i.e comments)
# TODO confirm atts for children
@project
.
to_json
(
Projects
::
ImportExport
.
project_tree
)
end
end
...
...
spec/services/projects/import_export/project_tree_saver_spec.rb
View file @
3b99e4ae
...
...
@@ -3,6 +3,8 @@ require 'spec_helper'
describe
Projects
::
ImportExport
::
ProjectTreeSaver
,
services:
true
do
describe
:save
do
# TODO refactor this into a setup method
let
(
:user
)
{
create
(
:user
)
}
let
(
:issue
)
{
create
(
:issue
,
assignee:
user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
)
}
...
...
@@ -25,6 +27,8 @@ describe Projects::ImportExport::ProjectTreeSaver, services: true do
let
(
:export_path
)
{
"
#{
Dir
::
tmpdir
}
/project_tree_saver_spec"
}
let
(
:shared
)
{
Projects
::
ImportExport
::
Shared
.
new
(
relative_path:
project
.
path_with_namespace
)
}
let
(
:project_tree_saver
)
{
Projects
::
ImportExport
::
ProjectTreeSaver
.
new
(
project:
project
,
shared:
shared
)
}
let!
(
:issue_note
)
{
create
(
:note
,
note:
":+1: issue"
,
noteable:
issue
)
}
let!
(
:merge_request_note
)
{
create
(
:note
,
note:
":+1: merge_request"
,
noteable:
merge_request
)
}
before
(
:each
)
do
project
.
team
<<
[
user
,
:master
]
...
...
@@ -78,6 +82,10 @@ describe Projects::ImportExport::ProjectTreeSaver, services: true do
expect
(
saved_project_json
[
'issues'
]).
not_to
be_empty
end
it
'has issue comments'
do
expect
(
saved_project_json
[
'issues'
].
first
[
'notes'
]).
not_to
be_empty
end
it
'has commit statuses'
do
expect
(
saved_project_json
[
'commit_statuses'
]).
not_to
be_empty
end
...
...
@@ -90,6 +98,10 @@ describe Projects::ImportExport::ProjectTreeSaver, services: true do
expect
(
saved_project_json
[
'merge_requests'
].
first
[
'merge_request_diff'
]).
not_to
be_empty
end
it
'has merge requests comments'
do
expect
(
saved_project_json
[
'merge_requests'
].
first
[
'notes'
]).
not_to
be_empty
end
it
'has ci commits'
do
expect
(
saved_project_json
[
'commit_statuses'
].
first
[
'commit'
]).
not_to
be_empty
end
...
...
@@ -99,163 +111,4 @@ describe Projects::ImportExport::ProjectTreeSaver, services: true do
def
project_json
(
filename
)
JSON
.
parse
(
IO
.
read
(
filename
))
end
# TODO: Remove this. Current JSON pretty printed:
# {
# "id":7,
# "name":"searchable_project",
# "path":"gitlabhq",
# "description":null,
# "issues_enabled":true,
# "wall_enabled":false,
# "merge_requests_enabled":true,
# "wiki_enabled":true,
# "snippets_enabled":true,
# "visibility_level":20,
# "archived":false,
# "issues":[
# {
# "id":1,
# "title":"Voluptas dolores molestias iste excepturi quia atque sint et.",
# "assignee_id":1,
# "author_id":2,
# "project_id":7,
# "created_at":"2016-03-08T09:14:31.726Z",
# "updated_at":"2016-03-08T09:14:36.293Z",
# "position":0,
# "branch_name":null,
# "description":null,
# "milestone_id":null,
# "state":"opened",
# "iid":1,
# "updated_by_id":null
# }
# ],
# "merge_requests":[
# {
# "id":1,
# "target_branch":"feature",
# "source_branch":"master",
# "source_project_id":2,
# "author_id":5,
# "assignee_id":null,
# "title":"Quam velit cupiditate culpa perspiciatis esse maiores quaerat.",
# "created_at":"2016-03-08T09:14:32.597Z",
# "updated_at":"2016-03-08T09:14:32.597Z",
# "milestone_id":null,
# "state":"opened",
# "merge_status":"can_be_merged",
# "target_project_id":7,
# "iid":1,
# "description":null,
# "position":0,
# "locked_at":null,
# "updated_by_id":null,
# "merge_error":null,
# "merge_params":{
#
# },
# "merge_when_build_succeeds":false,
# "merge_user_id":null,
# "merge_commit_sha":null
# }
# ],
# "labels":[
# {
# "id":1,
# "title":"Bug",
# "color":"#990000",
# "project_id":7,
# "created_at":"2016-03-08T09:14:33.774Z",
# "updated_at":"2016-03-08T09:14:36.314Z",
# "template":false,
# "description":null
# }
# ],
# "milestones":[
# {
# "id":1,
# "title":"Milestone v1.2",
# "project_id":7,
# "description":null,
# "due_date":null,
# "created_at":"2016-03-08T09:14:36.526Z",
# "updated_at":"2016-03-08T09:14:36.526Z",
# "state":"active",
# "iid":1
# }
# ],
# "snippets":[
# {
# "id":1,
# "title":"Voluptatem qui officiis modi ut fugit distinctio dolor qui.",
# "content":"Quaerat sunt eligendi voluptatum magnam.",
# "author_id":12,
# "project_id":7,
# "created_at":"2016-03-08T09:14:34.539Z",
# "updated_at":"2016-03-08T09:14:36.332Z",
# "file_name":"rowland.tremblay",
# "expires_at":null,
# "visibility_level":0
# }
# ],
# "releases":[
# {
# "id":1,
# "tag":"v1.1.0",
# "description":"Awesome release",
# "project_id":7,
# "created_at":"2016-03-08T09:14:35.023Z",
# "updated_at":"2016-03-08T09:14:36.351Z"
# }
# ],
# "events":[
# {
# "id":1,
# "target_type":null,
# "target_id":null,
# "title":null,
# "data":null,
# "project_id":7,
# "created_at":"2016-03-08T09:14:36.806Z",
# "updated_at":"2016-03-08T09:14:36.806Z",
# "action":8,
# "author_id":1
# }
# ],
# "commit_statuses":[
# {
# "id":1,
# "project_id":null,
# "status":"success",
# "finished_at":"2016-01-26T07:23:42.000Z",
# "trace":null,
# "created_at":"2016-03-08T09:14:35.633Z",
# "updated_at":"2016-03-08T09:14:36.385Z",
# "started_at":"2016-01-26T07:21:42.000Z",
# "runner_id":null,
# "coverage":null,
# "commit_id":1,
# "commands":null,
# "job_id":null,
# "name":"default",
# "deploy":false,
# "options":null,
# "allow_failure":false,
# "stage":null,
# "trigger_request_id":null,
# "stage_idx":null,
# "tag":null,
# "ref":null,
# "user_id":null,
# "target_url":null,
# "description":"commit status",
# "artifacts_file":null,
# "gl_project_id":7,
# "artifacts_metadata":null,
# "erased_by_id":null,
# "erased_at":null
# }
# ]
# }
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