Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mkexp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esmenv
mkexp
Commits
e346ddc6
Commit
e346ddc6
authored
3 years ago
by
Karl-Hermann Wieners
Browse files
Options
Downloads
Patches
Plain Diff
unmergeconfig: changed to insert globals into the appropriate section
parent
3ea194a3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
unmergeconfig
+18
-10
18 additions, 10 deletions
unmergeconfig
with
18 additions
and
10 deletions
unmergeconfig
+
18
−
10
View file @
e346ddc6
...
...
@@ -27,9 +27,12 @@ global_matcher = re.compile(r'\$(\w+)')
def
get_globals
(
config
,
result
):
for
key
in
config
.
sections
:
get_globals_section
(
config
[
key
],
key
,
config
.
scalars
,
result
)
get_globals_section
(
config
[
key
],
key
,
{
s
:
''
for
s
in
config
.
scalars
},
result
)
def
get_globals_section
(
section
,
path
,
global_keys
,
result
):
all_keys
=
global_keys
.
copy
()
all_keys
.
update
({
s
:
path
for
s
in
section
.
scalars
})
for
key
in
section
.
scalars
:
value
=
section
[
key
]
if
not
isinstance
(
value
,
(
list
,
tuple
)):
...
...
@@ -37,9 +40,10 @@ def get_globals_section(section, path, global_keys, result):
if
match
:
global_key
=
match
.
group
(
1
)
if
True
:
### global_key in global_keys:
result
[
path
+
'
/
'
+
key
]
=
global_key
result
[
path
+
'
/
'
+
key
]
=
(
global_key
,
all_keys
.
get
(
global_key
,
''
))
for
key
in
section
.
sections
:
get_globals_section
(
section
[
key
],
path
+
'
/
'
+
key
,
glob
al_keys
,
result
)
get_globals_section
(
section
[
key
],
path
+
'
/
'
+
key
,
a
l
l_keys
,
result
)
def
eval_globals
(
config
,
global_dict
):
for
key
in
config
.
sections
:
...
...
@@ -51,16 +55,20 @@ def eval_globals_section(section, path, global_dict):
if
not
isinstance
(
value
,
(
list
,
tuple
)):
global_key
=
path
+
'
/
'
+
key
if
global_key
in
global_dict
:
global_var
=
global_dict
[
global_key
]
if
global_var
in
section
.
main
:
if
section
.
main
[
global_var
]
!=
value
:
warn
(
"
global
'
%s
'
already set to
'
%s
'
,
"
"
keeping
'
%s
'
at
'
%s
'"
,
global_var
,
section
.
main
[
global_var
],
global_key
,
value
)
global_var
,
global_path
=
global_dict
[
global_key
]
global_section
=
section
.
main
if
global_path
:
for
name
in
global_path
.
split
(
'
/
'
):
global_section
=
global_section
[
name
]
if
global_var
in
global_section
:
if
global_section
[
global_var
]
!=
value
:
warn
(
"
global
'
%s
'
at
'
%s
'
already set to
'
%s
'
,
"
"
keeping
'
%s
'
at
'
%s
'"
,
global_var
,
global_path
,
global_section
[
global_var
],
global_key
,
value
)
else
:
section
[
key
]
=
'
$
'
+
global_var
else
:
section
.
main
[
global_var
]
=
value
global_
section
[
global_var
]
=
value
section
[
key
]
=
'
$
'
+
global_var
for
key
in
section
.
sections
:
eval_globals_section
(
section
[
key
],
path
+
'
/
'
+
key
,
global_dict
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment