diff options
Diffstat (limited to 'app/helpers/gitlab/compare_helper.rb')
-rw-r--r-- | app/helpers/gitlab/compare_helper.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/helpers/gitlab/compare_helper.rb b/app/helpers/gitlab/compare_helper.rb new file mode 100644 index 00000000000..407d25d3102 --- /dev/null +++ b/app/helpers/gitlab/compare_helper.rb @@ -0,0 +1,23 @@ +module Gitlab + module CompareHelper + def create_mr_button?(from = params[:from], to = params[:to], project = @project) + from.present? && + to.present? && + from != to && + project.merge_requests_enabled && + project.repository.branch_names.include?(from) && + project.repository.branch_names.include?(to) + end + + def create_mr_path(from = params[:from], to = params[:to], project = @project) + new_namespace_project_merge_request_path( + project.namespace, + project, + merge_request: { + source_branch: to, + target_branch: from + } + ) + end + end +end |