2013-06-23 12:47:22 -04:00
|
|
|
class Projects::CompareController < Projects::ApplicationController
|
2012-09-20 15:20:48 -04:00
|
|
|
# Authorize
|
2014-10-13 15:31:49 -04:00
|
|
|
before_filter :authorize_download_code!
|
2012-09-20 15:20:48 -04:00
|
|
|
before_filter :require_non_empty_project
|
|
|
|
|
2012-09-25 23:10:50 -04:00
|
|
|
def index
|
|
|
|
end
|
|
|
|
|
2012-09-20 15:20:48 -04:00
|
|
|
def show
|
2014-07-29 05:33:51 -04:00
|
|
|
base_ref = params[:from]
|
|
|
|
head_ref = params[:to]
|
2012-09-20 15:20:48 -04:00
|
|
|
|
2014-07-29 05:33:51 -04:00
|
|
|
compare_result = CompareService.new.execute(
|
|
|
|
current_user,
|
|
|
|
@project,
|
2014-07-29 05:42:01 -04:00
|
|
|
head_ref,
|
2014-07-29 05:33:51 -04:00
|
|
|
@project,
|
2014-07-29 05:42:01 -04:00
|
|
|
base_ref
|
2014-07-29 05:33:51 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
@commits = compare_result.commits
|
|
|
|
@diffs = compare_result.diffs
|
|
|
|
@commit = @commits.last
|
|
|
|
@line_notes = []
|
2012-09-20 15:20:48 -04:00
|
|
|
end
|
2012-09-25 23:10:50 -04:00
|
|
|
|
|
|
|
def create
|
|
|
|
redirect_to project_compare_path(@project, params[:from], params[:to])
|
|
|
|
end
|
2012-09-20 15:20:48 -04:00
|
|
|
end
|