This instance will be upgraded to Heptapod 0.20.1 on 2020-03-08 at 14:00 UTC+1 (10 minutes of downtime)

Commit b59ce275 authored by Georges Racinet's avatar Georges Racinet 🦑

HgGitRepository#hg_call: fix for user=nil

hg_call is now used in the methods supporting backup and
restoration (`#bundle_to_disk` and `#create_from_bundle`).

There's no obvious GitLab user for these callers, and it
should be irrelevant for Mercurial anyway.

--HG--
branch : heptapod
parent aa083d55dd26
......@@ -502,6 +502,7 @@ def hg_changeset_publish(user, hgsha, notify_gitlab: false, for_mr_iid: nil)
def hg_call(args, user, path, env: nil, for_write: false,
success_code_can_be_one: false,
force_system_user: false)
if env.nil?
if for_write
env = hg_env_for_write(user, force_system_user: force_system_user)
......@@ -509,9 +510,21 @@ def hg_call(args, user, path, env: nil, for_write: false,
env = hg_env_minimal
end
end
username = hg_prepare_user_encoding(env, user, "")
cmd = [Gitlab.config.mercurial.bin_path,
'--config', 'ui.username=' + username] + args
cmd = [Gitlab.config.mercurial.bin_path] + args
username =
if force_system_user
"Heptapod system"
elsif !user.nil?
hg_prepare_user_encoding(env, user, "")
else
nil
end
unless username.nil?
cmd.extend(['--config', 'ui.username=' + username])
end
output, status = popen(cmd, path, env)
if for_write
hg_git_invalidate_maps!
......
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