2014-09-02 18:07:02 +05:30
|
|
|
class Projects::CompareController < Projects::ApplicationController
|
|
|
|
# Authorize
|
|
|
|
before_filter :require_non_empty_project
|
2015-04-26 12:48:37 +05:30
|
|
|
before_filter :authorize_download_code!
|
2014-09-02 18:07:02 +05:30
|
|
|
|
|
|
|
def index
|
|
|
|
end
|
|
|
|
|
|
|
|
def show
|
|
|
|
base_ref = params[:from]
|
|
|
|
head_ref = params[:to]
|
|
|
|
|
|
|
|
compare_result = CompareService.new.execute(
|
|
|
|
current_user,
|
|
|
|
@project,
|
|
|
|
head_ref,
|
|
|
|
@project,
|
|
|
|
base_ref
|
|
|
|
)
|
|
|
|
|
|
|
|
@commits = compare_result.commits
|
|
|
|
@diffs = compare_result.diffs
|
|
|
|
@commit = @commits.last
|
|
|
|
@line_notes = []
|
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
2015-04-26 12:48:37 +05:30
|
|
|
redirect_to namespace_project_compare_path(@project.namespace, @project,
|
|
|
|
params[:from], params[:to])
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|