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
0f2dff62
Commit
0f2dff62
authored
Apr 23, 2019
by
charlieablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exclude fields from note import
parent
30940ccd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
2 deletions
+29
-2
lib/gitlab/import_export/import_export.yml
lib/gitlab/import_export/import_export.yml
+3
-0
spec/lib/gitlab/import_export/project.json
spec/lib/gitlab/import_export/project.json
+4
-0
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
+22
-2
No files found.
lib/gitlab/import_export/import_export.yml
View file @
0f2dff62
...
@@ -141,6 +141,9 @@ excluded_attributes:
...
@@ -141,6 +141,9 @@ excluded_attributes:
-
:external_diff_size
-
:external_diff_size
issues
:
issues
:
-
:milestone_id
-
:milestone_id
notes
:
-
:note_html
-
:cached_markdown_version
merge_requests
:
merge_requests
:
-
:milestone_id
-
:milestone_id
-
:ref_fetched
-
:ref_fetched
...
...
spec/lib/gitlab/import_export/project.json
View file @
0f2dff62
...
@@ -158,6 +158,8 @@
...
@@ -158,6 +158,8 @@
{
{
"id"
:
351
,
"id"
:
351
,
"note"
:
"Quo reprehenderit aliquam qui dicta impedit cupiditate eligendi."
,
"note"
:
"Quo reprehenderit aliquam qui dicta impedit cupiditate eligendi."
,
"note_html"
:
"<p>dodgy html</p>"
,
"cached_markdown_version"
:
434343
,
"noteable_type"
:
"Issue"
,
"noteable_type"
:
"Issue"
,
"author_id"
:
26
,
"author_id"
:
26
,
"created_at"
:
"2016-06-14T15:02:47.770Z"
,
"created_at"
:
"2016-06-14T15:02:47.770Z"
,
...
@@ -182,6 +184,8 @@
...
@@ -182,6 +184,8 @@
"note"
:
"Est reprehenderit quas aut aspernatur autem recusandae voluptatem."
,
"note"
:
"Est reprehenderit quas aut aspernatur autem recusandae voluptatem."
,
"noteable_type"
:
"Issue"
,
"noteable_type"
:
"Issue"
,
"author_id"
:
25
,
"author_id"
:
25
,
"note_html"
:
"<p>dodgy html</p>"
,
"cached_markdown_version"
:
121212
,
"created_at"
:
"2016-06-14T15:02:47.795Z"
,
"created_at"
:
"2016-06-14T15:02:47.795Z"
,
"updated_at"
:
"2016-06-14T15:02:47.795Z"
,
"updated_at"
:
"2016-06-14T15:02:47.795Z"
,
"project_id"
:
5
,
"project_id"
:
5
,
...
...
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
View file @
0f2dff62
...
@@ -7,8 +7,8 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
...
@@ -7,8 +7,8 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
# Using an admin for import, so we can check assignment of existing members
# Using an admin for import, so we can check assignment of existing members
@user
=
create
(
:admin
)
@user
=
create
(
:admin
)
@existing_members
=
[
@existing_members
=
[
create
(
:user
,
username:
'bernard_willms'
),
create
(
:user
,
username:
'bernard_willms'
),
create
(
:user
,
username:
'saul_will'
)
create
(
:user
,
username:
'saul_will'
)
]
]
RSpec
::
Mocks
.
with_temporary_scope
do
RSpec
::
Mocks
.
with_temporary_scope
do
...
@@ -21,6 +21,8 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
...
@@ -21,6 +21,8 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
expect_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:create_branch
).
with
(
'feature'
,
'DCBA'
)
expect_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:create_branch
).
with
(
'feature'
,
'DCBA'
)
allow_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:create_branch
)
allow_any_instance_of
(
Gitlab
::
Git
::
Repository
).
to
receive
(
:create_branch
)
allow_any_instance_of
(
Project
).
to
receive
(
:latest_cached_markdown_version
).
and_return
(
434343
)
allow_any_instance_of
(
Note
).
to
receive
(
:latest_cached_markdown_version
).
and_return
(
434343
)
project_tree_restorer
=
described_class
.
new
(
user:
@user
,
shared:
@shared
,
project:
@project
)
project_tree_restorer
=
described_class
.
new
(
user:
@user
,
shared:
@shared
,
project:
@project
)
...
@@ -58,6 +60,24 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
...
@@ -58,6 +60,24 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
expect
(
Milestone
.
find_by_description
(
'test milestone'
).
issues
.
count
).
to
eq
(
2
)
expect
(
Milestone
.
find_by_description
(
'test milestone'
).
issues
.
count
).
to
eq
(
2
)
end
end
context
'when importing a project with cached_markdown_version and note_html'
do
let!
(
:issue
)
{
Issue
.
find_by
(
description:
'Aliquam enim illo et possimus.'
)
}
let
(
:note1
)
{
issue
.
notes
.
select
{
|
n
|
n
.
note
.
match
(
/Quo reprehenderit aliquam qui dicta impedit cupiditate eligendi/
)}.
first
}
let
(
:note2
)
{
issue
.
notes
.
select
{
|
n
|
n
.
note
.
match
(
/Est reprehenderit quas aut aspernatur autem recusandae voluptatem/
)}.
first
}
it
'does not import the note_html'
do
expect
(
note1
.
note_html
).
to
match
(
/Et hic est id similique et non nesciunt voluptate/
)
end
it
'does not set the old cached_markdown_version'
do
expect
(
note2
.
cached_markdown_version
).
not_to
eq
(
121212
)
end
it
'does not import the note_html'
do
expect
(
note2
.
note_html
).
to
match
(
/Est reprehenderit quas aut aspernatur autem recusandae voluptatem/
)
end
end
it
'creates a valid pipeline note'
do
it
'creates a valid pipeline note'
do
expect
(
Ci
::
Pipeline
.
find_by_sha
(
'sha-notes'
).
notes
).
not_to
be_empty
expect
(
Ci
::
Pipeline
.
find_by_sha
(
'sha-notes'
).
notes
).
not_to
be_empty
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