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
385468e0
Commit
385468e0
authored
Dec 13, 2019
by
nmilojevic1
Committed by
Stan Hu
Dec 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix MR comments
- Added author column inside Where - Made configuration_helper more generalised
parent
0fac0300
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
12 deletions
+14
-12
spec/lib/gitlab/import_export/attribute_configuration_spec.rb
.../lib/gitlab/import_export/attribute_configuration_spec.rb
+1
-1
spec/lib/gitlab/import_export/model_configuration_spec.rb
spec/lib/gitlab/import_export/model_configuration_spec.rb
+1
-1
spec/lib/gitlab/import_export/references_configuration_spec.rb
...lib/gitlab/import_export/references_configuration_spec.rb
+5
-3
spec/support/import_export/configuration_helper.rb
spec/support/import_export/configuration_helper.rb
+7
-7
No files found.
spec/lib/gitlab/import_export/attribute_configuration_spec.rb
View file @
385468e0
...
...
@@ -16,7 +16,7 @@ describe 'Import/Export attribute configuration' do
let
(
:safe_model_attributes
)
{
YAML
.
load_file
(
safe_attributes_file
)
}
it
'has no new columns'
do
project_relation_names
.
each
do
|
relation_name
|
relation_names_for
(
:project
)
.
each
do
|
relation_name
|
relation_class
=
relation_class_for_name
(
relation_name
)
relation_attributes
=
relation_class
.
new
.
attributes
.
keys
-
relation_class
.
encrypted_attributes
.
keys
.
map
(
&
:to_s
)
...
...
spec/lib/gitlab/import_export/model_configuration_spec.rb
View file @
385468e0
...
...
@@ -11,7 +11,7 @@ describe 'Import/Export model configuration' do
let
(
:all_models_yml
)
{
'spec/lib/gitlab/import_export/all_models.yml'
}
let
(
:all_models_hash
)
{
YAML
.
load_file
(
all_models_yml
)
}
let
(
:current_models
)
{
setup_models
}
let
(
:model_names
)
{
project_relation_names
}
let
(
:model_names
)
{
relation_names_for
(
:project
)
}
it
'has no new models'
do
model_names
.
each
do
|
model_name
|
...
...
spec/lib/gitlab/import_export/references_configuration_spec.rb
View file @
385468e0
...
...
@@ -13,12 +13,14 @@ describe 'Import/Export Project configuration' do
include
ConfigurationHelper
where
(
:relation_path
,
:relation_name
)
do
project_relation_paths
.
map
{
|
a
|
[
a
.
join
(
"."
),
a
.
last
]}
relation_paths_for
(
:project
).
map
do
|
relation_names
|
next
if
relation_names
.
last
==
"author"
[
relation_names
.
join
(
"."
),
relation_names
.
last
]
end
.
compact
end
with_them
do
next
if
params
[
:relation_name
]
==
"author"
context
"where relation
#{
params
[
:relation_path
]
}
"
do
it
'does not have prohibited keys'
do
relation_class
=
relation_class_for_name
(
relation_name
)
...
...
spec/support/import_export/configuration_helper.rb
View file @
385468e0
...
...
@@ -22,22 +22,22 @@ module ConfigurationHelper
new_hash
end
def
config_hash
Gitlab
::
ImportExport
::
Config
.
new
.
to_h
.
deep_stringify_keys
def
config_hash
(
config
=
Gitlab
::
ImportExport
.
config_file
)
Gitlab
::
ImportExport
::
Config
.
new
(
config:
config
)
.
to_h
.
deep_stringify_keys
end
def
project_relation_paths
def
relation_paths_for
(
key
,
config:
Gitlab
::
ImportExport
.
config_file
)
# - project is not part of the tree, so it has to be added manually.
flat_hash
({
"project"
=>
config_hash
.
dig
(
'tree'
,
'project'
)
}).
keys
flat_hash
({
"project"
=>
config_hash
(
config
).
dig
(
'tree'
,
key
.
to_s
)
}).
keys
end
def
project_relation_names
names
=
names_from_tree
(
config_hash
.
dig
(
'tree'
,
'project'
))
def
relation_names_for
(
key
,
config:
Gitlab
::
ImportExport
.
config_file
)
names
=
names_from_tree
(
config_hash
(
config
).
dig
(
'tree'
,
key
.
to_s
))
# Remove duplicated or add missing models
# - project is not part of the tree, so it has to be added manually.
# - milestone, labels, merge_request have both singular and plural versions in the tree, so remove the duplicates.
# - User, Author... Models we do not care about for checking models
names
.
flatten
.
uniq
-
%w(milestones labels user author merge_request design)
+
[
'project'
]
names
.
flatten
.
uniq
-
%w(milestones labels user author merge_request design)
+
[
key
.
to_s
]
end
def
relation_class_for_name
(
relation_name
)
...
...
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