Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
ff5823e89d14
Commit
941f60f0
authored
Aug 24, 2020
by
Georges Racinet
🦑
Browse files
HgGitRepository: split out hg_config_item_bool? method
This is just cleaner and prone to reuse. --HG-- branch : heptapod-stable
parent
7ef09f4b1371
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/gitlab/mercurial/hg_git_repository.rb
View file @
ff5823e8
...
...
@@ -58,6 +58,19 @@ def hg_full_path
@hgpath
end
def
hg_config_item_bool?
(
full_dotted_name
)
env
=
{
'HGRCPATH'
=>
Gitlab
::
Mercurial
.
hgrc_path
}
val_str
,
status
=
popen
(
[
Gitlab
.
config
.
mercurial
.
bin_path
,
'config'
,
full_dotted_name
],
@hgpath
,
env
)
return
false
if
status
==
1
# status 1 means value is missing
raise
HgError
,
"Could not read `
#{
full_dotted_name
}
` config item for
#{
@hgpath
}
"
unless
status
==
0
HG_CONFIG_TRUE
.
include?
(
val_str
.
downcase
.
strip
)
end
def
create_repository
(
**
named_args
)
# at the time being all named_args are Mercurial specific. Still,
# passing explicitely is more future proof
...
...
@@ -1008,10 +1021,8 @@ def multi_action(user, branch_name:, message:, actions:,
commit_hgsha
=
hg_commit
(
share_path
,
username
,
message
,
hg_env
,
true
)
logger
.
info
(
"
#{
logprefix
}
commit done, changeset is
#{
commit_hgsha
}
"
)
if
topic
.
nil?
publish_str
,
status
=
popen
([
hg_exe
,
'config'
,
'experimental.topic.publish-bare-branch'
],
share_path
,
hg_env
)
publish
=
[
'yes'
,
'true'
,
'on'
,
'1'
].
include?
(
publish_str
.
downcase
.
strip
)
hg_changeset_publish
(
user
,
commit_hgsha
,
notify_gitlab:
true
)
if
publish
if
topic
.
nil?
&&
hg_config_item_bool?
(
'experimental.topic.publish-bare-branch'
)
hg_changeset_publish
(
user
,
commit_hgsha
,
notify_gitlab:
true
)
end
commit_hgsha
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