compare_controller.rb 659 字节
Newer Older
1
class Projects::CompareController < Projects::ApplicationController
2 3 4 5 6
  # Authorize
  before_filter :authorize_read_project!
  before_filter :authorize_code_access!
  before_filter :require_non_empty_project

7 8 9
  def index
  end

10
  def show
11 12
    base_ref = params[:from]
    head_ref = params[:to]
13

14 15 16
    compare_result = CompareService.new.execute(
      current_user,
      @project,
17
      head_ref,
18
      @project,
19
      base_ref
20 21 22 23 24 25
    )

    @commits = compare_result.commits
    @diffs = compare_result.diffs
    @commit = @commits.last
    @line_notes = []
26
  end
27 28 29 30

  def create
    redirect_to project_compare_path(@project, params[:from], params[:to])
  end
31
end