{{template "repo/header" .}} {{$showDiffBox := false}}

{{if and $.PageIsComparePull $.IsSigned (not .Repository.IsArchived)}} {{.locale.Tr "repo.pulls.compare_changes"}}
{{.locale.Tr "repo.pulls.compare_changes_desc"}}
{{else}} {{.locale.Tr "action.compare_commits_general"}} {{end}}

{{if .Flash.WarningMsg}} {{/* There's already an importing of alert.tmpl in new_form.tmpl, but only the negative message will be displayed within forms for some reasons, see semantic.css:10659. To avoid repeated negative messages, the importing here if for .Flash.WarningMsg only. */}} {{template "base/alert" .}} {{end}} {{$BaseCompareName := $.BaseName -}} {{- $HeadCompareName := $.HeadRepo.OwnerName -}} {{- if and (eq $.BaseName $.HeadRepo.OwnerName) (ne $.Repository.Name $.HeadRepo.Name) -}} {{- $HeadCompareName = printf "%s/%s" $.HeadRepo.OwnerName $.HeadRepo.Name -}} {{- end -}} {{- $OwnForkCompareName := "" -}} {{- if .OwnForkRepo -}} {{- $OwnForkCompareName = .OwnForkRepo.OwnerName -}} {{- end -}} {{- $RootRepoCompareName := "" -}} {{- if .RootRepo -}} {{- $RootRepoCompareName = .RootRepo.OwnerName -}} {{- if eq $.HeadRepo.OwnerName .RootRepo.OwnerName -}} {{- $HeadCompareName = printf "%s/%s" $.HeadRepo.OwnerName $.HeadRepo.Name -}} {{- end -}} {{- end -}}
{{svg "octicon-git-compare"}} {{.CompareSeparator}}
{{if .IsNothingToCompare}} {{if and $.IsSigned $.AllowEmptyPr (not .Repository.IsArchived)}}
{{.locale.Tr "repo.pulls.nothing_to_compare_and_allow_empty_pr"}}
{{template "repo/issue/new_form" .}}
{{else}}
{{.locale.Tr "repo.pulls.nothing_to_compare"}}
{{end}} {{else if and .PageIsComparePull (gt .CommitCount 0)}} {{if .HasPullRequest}}
{{.locale.Tr "repo.pulls.has_pull_request" (Escape $.RepoLink) (Escape $.RepoRelPath) .PullRequest.Index | Safe}}

{{RenderIssueTitle $.Context .PullRequest.Issue.Title $.RepoLink $.Repository.ComposeMetas}} #{{.PullRequest.Issue.Index}}

{{else}} {{if and $.IsSigned (not .Repository.IsArchived)}}
{{else if .Repository.IsArchived}}
{{if .Repository.ArchivedUnix.IsZero}} {{.locale.Tr "repo.archive.title"}} {{else}} {{.locale.Tr "repo.archive.title_date" (DateTime "long" .Repository.ArchivedUnix) | Safe}} {{end}}
{{end}} {{if $.IsSigned}}
{{template "repo/issue/new_form" .}}
{{end}} {{$showDiffBox = true}} {{end}} {{else}} {{$showDiffBox = true}} {{end}}
{{if $showDiffBox}}
{{template "repo/commits_table" .}}
{{template "repo/diff/box" .}}
{{end}}