Commit 941f60f0 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

HgGitRepository: split out hg_config_item_bool? method

This is just cleaner and prone to reuse.

branch : heptapod-stable
parent 7ef09f4b1371
......@@ -58,6 +58,19 @@ def hg_full_path
def hg_config_item_bool?(full_dotted_name)
env = { 'HGRCPATH' => Gitlab::Mercurial.hgrc_path }
val_str, status = popen(
'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
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)"#{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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment