Commit d1aba8b7 authored by Georges Racinet on mutations.racinet.fr's avatar Georges Racinet on mutations.racinet.fr
Browse files

HgGitRepository tests: using multi_action in rebase preparation

parent db821ec4ea3f
......@@ -73,6 +73,4 @@
subject.remove
end
hg_exe = Gitlab.config.mercurial.bin_path
it "is refused on named branches" do
......@@ -78,9 +76,11 @@
it "is refused on named branches" do
hg_env = subject.hg_env_for_write(user) # yes, disables hooks
file_path = Pathname(non_empty_repository_path).join('foo')
file_path.write("foo1\n")
subject.hg_commit(mutable_repository_path,
"John Doe1 <jdoe1@heptapod.example>",
"Commit 1", hg_env, true)
subject.multi_action(user,
branch_name: 'branch/other',
start_branch_name: 'branch/default',
message: "Commit on other branch",
author_email: "jdoe1@heptapod.test",
author_name: "John Doe1",
actions: [{ action: :create,
file_path: 'other',
content: "other foo\n" }])
......@@ -86,18 +86,14 @@
# TODO would be better to have submethods for this.
_, status = subject.popen([hg_exe, 'update', '0'],
mutable_repository_path, hg_env)
expect(status).to eq(0)
_, status = subject.popen([hg_exe, 'branch', 'other'],
mutable_repository_path, hg_env)
expect(status).to eq(0)
file_path.write("foo other\n")
other_hgsha = subject.hg_commit(mutable_repository_path,
"John Doe1 <jdoe1@heptapod.example>",
"Other", hg_env, true)
subject.multi_action(user,
branch_name: 'branch/default',
start_branch_name: 'branch/default',
message: "Commit on default",
author_email: "jdoe1@heptapod.test",
author_name: "John Doe1",
actions: [{ action: :update,
file_path: 'foo',
content: "foo1\n" }])
expect do
subject.rebase(nil, 1,
branch: 'branch/other',
......@@ -100,8 +96,8 @@
expect do
subject.rebase(nil, 1,
branch: 'branch/other',
branch_sha: other_hgsha,
branch_sha: subject.hgsha_from_rev('other'),
remote_repository: subject,
remote_branch: 'branch/default')
end.to raise_error(Gitlab::Mercurial::HgGitRepository::HgError)
......
Supports Markdown
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