Commit f8ae0b89 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Fixing HgGitRepository#create_from_bundle

As the name suggests, it must create the repo.
Also `for_write` is really useful, prevents potentially
harmful hooks to be fired, notably.

--HG--
branch : heptapod
parent ac73aa1d3c2d
...@@ -522,7 +522,7 @@ def hg_call(args, user, path, env: nil, for_write: false, ...@@ -522,7 +522,7 @@ def hg_call(args, user, path, env: nil, for_write: false,
end end
unless username.nil? unless username.nil?
cmd.extend(['--config', 'ui.username=' + username]) cmd.append('--config', 'ui.username=' + username)
end end
output, status = popen(cmd, path, env) output, status = popen(cmd, path, env)
...@@ -991,9 +991,17 @@ def backup_config(save_path) ...@@ -991,9 +991,17 @@ def backup_config(save_path)
# actual paths for Mercurial (bundle and config) are deduced from it # actual paths for Mercurial (bundle and config) are deduced from it
# See also doc-comment for #bundle_to_disk. # See also doc-comment for #bundle_to_disk.
def create_from_bundle(path_to_bundle) def create_from_bundle(path_to_bundle)
super(path_to_bundle)
# same path used as cwd as in hg_create_repository()
# we don't know namespace arguments that would be used to
# call the latter, but it doesn't matter, since all config will
# be restored
hg_call(["init", @hgpath], nil, @hg_storage_root,
for_write: true, force_system_user: true)
restore_config(path_to_bundle) restore_config(path_to_bundle)
hg_call(["unbundle", hg_bundle_path(path_to_bundle)], hg_call(["unbundle", hg_bundle_path(path_to_bundle)], nil, @hgpath,
nil, @hgpath, force_system_user: true) for_write: true, force_system_user: true)
end end
def restore_config(path_to_bundle) def restore_config(path_to_bundle)
......
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