BigW Consortium Gitlab

Commit 58064027 by Izaak Alpert

Raise Error for diff_between/commit_between for non fork mr's in satellite

-Fixed tests to account for this -Trigger update after update_branches for list:update selecting first commit, have it also trigger sha lookup Change-Id: Ie4c3d4fbf57aeadd7d141d3704f4ea0f0684a7a5
parent 0e82c981
:plain
$(".target_branch").html("#{escape_javascript(options_for_select(@target_branches))}");
$(".target_branch").trigger("liszt:updated");
$(".mr_target_commit").html("");
\ No newline at end of file
$(".mr_target_commit").html("");
$(".target_branch").trigger("change");
\ No newline at end of file
......@@ -74,9 +74,7 @@ module Gitlab
#this method doesn't take default options
diffs = merge_repo.diff(common_commit, "source/#{merge_request.source_branch}")
else
common_commit = merge_repo.git.native(:merge_base, default_options, ["#{merge_request.target_branch}", "#{merge_request.source_branch}"]).strip
#this method doesn't take default options
diffs = merge_repo.diff(common_commit, "#{merge_request.source_branch}")
raise "Attempt to determine diffs between for a non forked merge request in satellite MergeRequest.id:[#{merge_request.id}]"
end
diffs = diffs.map { |diff| Gitlab::Git::Diff.new(diff) }
return diffs
......@@ -109,7 +107,7 @@ module Gitlab
if (merge_request.for_fork?)
commits = merge_repo.commits_between("origin/#{merge_request.target_branch}", "source/#{merge_request.source_branch}")
else
commits = merge_repo.commits_between("#{merge_request.target_branch}", "#{merge_request.source_branch}")
raise "Attempt to determine commits between for a non forked merge request in satellite MergeRequest.id:[#{merge_request.id}]"
end
commits = commits.map { |commit| Gitlab::Git::Commit.new(commit, nil) }
return commits
......
......@@ -38,16 +38,14 @@ describe 'Gitlab::Satellite::MergeAction' do
end
context 'between branches' do
it 'should get proper commits between' do
it 'should raise exception -- not expected to be used by non forks' do
merge_request.target_branch = @one_after_stable[0]
merge_request.source_branch = @master[0]
commits = Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).commits_between
verify_commits(commits, @one_after_stable[1], @master[1])
expect {Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).commits_between}.to raise_error
merge_request.target_branch = @wiki_branch[0]
merge_request.source_branch = @master[0]
commits = Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).commits_between
verify_commits(commits, @wiki_branch[1], @master[1])
expect {Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).commits_between}.to raise_error
end
end
end
......@@ -104,13 +102,7 @@ describe 'Gitlab::Satellite::MergeAction' do
it 'should get proper diffs' do
merge_request.target_branch = @close_commit1[0]
merge_request.source_branch = @master[0]
diffs = Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).diffs_between_satellite
merge_request.target_branch = @close_commit1[0]
merge_request.source_branch = @master[0]
diff = Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).diff_in_satellite
is_a_matching_diff(diff, diffs)
expect{Gitlab::Satellite::MergeAction.new(merge_request.author, merge_request).diffs_between_satellite}.to raise_error
end
end
end
......
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