2013-09-12 13:15:10 -04:00
|
|
|
module CompareHelper
|
|
|
|
def compare_to_mr_button?
|
2013-12-04 03:02:36 -05:00
|
|
|
@project.merge_requests_enabled &&
|
2015-02-02 23:36:54 -05:00
|
|
|
params[:from].present? &&
|
2013-12-04 03:02:36 -05:00
|
|
|
params[:to].present? &&
|
2013-09-12 13:15:10 -04:00
|
|
|
@repository.branch_names.include?(params[:from]) &&
|
|
|
|
@repository.branch_names.include?(params[:to]) &&
|
2013-09-12 14:39:27 -04:00
|
|
|
params[:from] != params[:to] &&
|
2013-09-12 13:15:10 -04:00
|
|
|
!@refs_are_same
|
|
|
|
end
|
|
|
|
|
|
|
|
def compare_mr_path
|
2015-01-24 13:02:58 -05:00
|
|
|
new_namespace_project_merge_request_path(
|
|
|
|
@project.namespace,
|
|
|
|
@project,
|
|
|
|
merge_request: {
|
|
|
|
source_branch: params[:to],
|
|
|
|
target_branch: params[:from]
|
|
|
|
}
|
|
|
|
)
|
2013-09-12 13:15:10 -04:00
|
|
|
end
|
|
|
|
end
|