Commit ce088cd4 authored by Amy Qualls's avatar Amy Qualls Committed by Mikołaj Wawrzyniak

Make squash/rebase failed messages better

We could be more descriptive in these messages, so let's bring them
closer to our style standards and give more information.

Changelog: changed
parent 34760e19
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
module MergeRequests module MergeRequests
class RebaseService < MergeRequests::BaseService class RebaseService < MergeRequests::BaseService
REBASE_ERROR = 'Rebase failed. Please rebase locally' REBASE_ERROR = 'Rebase failed: Rebase locally, resolve all conflicts, then push the branch.'
attr_reader :merge_request, :rebase_error attr_reader :merge_request, :rebase_error
...@@ -35,7 +35,7 @@ module MergeRequests ...@@ -35,7 +35,7 @@ module MergeRequests
def set_rebase_error(exception) def set_rebase_error(exception)
@rebase_error = @rebase_error =
if exception.is_a?(Gitlab::Git::PreReceiveError) if exception.is_a?(Gitlab::Git::PreReceiveError)
"Something went wrong during the rebase pre-receive hook: #{exception.message}." "The rebase pre-receive hook failed: #{exception.message}."
else else
REBASE_ERROR REBASE_ERROR
end end
......
...@@ -9,9 +9,9 @@ module MergeRequests ...@@ -9,9 +9,9 @@ module MergeRequests
return success(squash_sha: merge_request.diff_head_sha) return success(squash_sha: merge_request.diff_head_sha)
end end
return error(s_('MergeRequests|This project does not allow squashing commits when merge requests are accepted.')) if squash_forbidden? return error(s_("MergeRequests|Squashing not allowed: This project doesn't allow you to squash commits when merging.")) if squash_forbidden?
squash! || error(s_('MergeRequests|Failed to squash. Should be done manually.')) squash! || error(s_('MergeRequests|Squashing failed: Squash the commits locally, resolve any conflicts, then push the branch.'))
end end
private private
......
...@@ -22680,13 +22680,13 @@ msgstr "" ...@@ -22680,13 +22680,13 @@ msgstr ""
msgid "MergeRequests|Create issue to resolve thread" msgid "MergeRequests|Create issue to resolve thread"
msgstr "" msgstr ""
msgid "MergeRequests|Failed to squash. Should be done manually." msgid "MergeRequests|Saving the comment failed"
msgstr "" msgstr ""
msgid "MergeRequests|Saving the comment failed" msgid "MergeRequests|Squashing failed: Squash the commits locally, resolve any conflicts, then push the branch."
msgstr "" msgstr ""
msgid "MergeRequests|This project does not allow squashing commits when merge requests are accepted." msgid "MergeRequests|Squashing not allowed: This project doesn't allow you to squash commits when merging."
msgstr "" msgstr ""
msgid "MergeRequests|Thread stays resolved" msgid "MergeRequests|Thread stays resolved"
......
...@@ -388,7 +388,7 @@ RSpec.describe MergeRequests::MergeService do ...@@ -388,7 +388,7 @@ RSpec.describe MergeRequests::MergeService do
end end
it 'logs and saves error if there is an error when squashing' do it 'logs and saves error if there is an error when squashing' do
error_message = 'Failed to squash. Should be done manually' error_message = 'Squashing failed: Squash the commits locally, resolve any conflicts, then push the branch.'
allow_any_instance_of(MergeRequests::SquashService).to receive(:squash!).and_return(nil) allow_any_instance_of(MergeRequests::SquashService).to receive(:squash!).and_return(nil)
merge_request.update!(squash: true) merge_request.update!(squash: true)
......
...@@ -82,7 +82,7 @@ RSpec.describe MergeRequests::RebaseService do ...@@ -82,7 +82,7 @@ RSpec.describe MergeRequests::RebaseService do
context 'with a pre-receive failure' do context 'with a pre-receive failure' do
let(:pre_receive_error) { "Commit message does not follow the pattern 'ACME'" } let(:pre_receive_error) { "Commit message does not follow the pattern 'ACME'" }
let(:merge_error) { "Something went wrong during the rebase pre-receive hook: #{pre_receive_error}." } let(:merge_error) { "The rebase pre-receive hook failed: #{pre_receive_error}." }
before do before do
allow(repository).to receive(:gitaly_operation_client).and_raise(Gitlab::Git::PreReceiveError, "GitLab: #{pre_receive_error}") allow(repository).to receive(:gitaly_operation_client).and_raise(Gitlab::Git::PreReceiveError, "GitLab: #{pre_receive_error}")
......
...@@ -168,7 +168,7 @@ RSpec.describe MergeRequests::SquashService do ...@@ -168,7 +168,7 @@ RSpec.describe MergeRequests::SquashService do
it 'raises a squash error' do it 'raises a squash error' do
expect(service.execute).to match( expect(service.execute).to match(
status: :error, status: :error,
message: a_string_including('does not allow squashing commits when merge requests are accepted')) message: a_string_including('allow you to squash commits when merging'))
end end
end end
...@@ -205,7 +205,7 @@ RSpec.describe MergeRequests::SquashService do ...@@ -205,7 +205,7 @@ RSpec.describe MergeRequests::SquashService do
end end
it 'returns an error' do it 'returns an error' do
expect(service.execute).to match(status: :error, message: a_string_including('squash')) expect(service.execute).to match(status: :error, message: a_string_including('Squash'))
end end
end end
end end
...@@ -232,7 +232,7 @@ RSpec.describe MergeRequests::SquashService do ...@@ -232,7 +232,7 @@ RSpec.describe MergeRequests::SquashService do
end end
it 'returns an error' do it 'returns an error' do
expect(service.execute).to match(status: :error, message: a_string_including('squash')) expect(service.execute).to match(status: :error, message: a_string_including('Squash'))
end end
it 'cleans up the temporary directory' do it 'cleans up the temporary directory' do
......
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