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

{{if and $.PageIsComparePull $.IsSigned (not .Repository.IsArchived)}} {{ctx.Locale.Tr "repo.pulls.compare_changes"}}
{{ctx.Locale.Tr "repo.pulls.compare_changes_desc"}}
{{else}} {{ctx.Locale.Tr "action.compare_commits_general"}} {{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"}} {{svg "octicon-arrow-left" 16}}
{{.CompareSeparator}}
{{if .IsNothingToCompare}} {{if and $.IsSigned $.AllowEmptyPr (not .Repository.IsArchived) .PageIsComparePull}}
{{ctx.Locale.Tr "repo.pulls.nothing_to_compare_and_allow_empty_pr"}}
{{template "repo/issue/new_form" .}}
{{else if and .HeadIsBranch .BaseIsBranch}}
{{ctx.Locale.Tr "repo.pulls.nothing_to_compare"}}
{{else}}
{{ctx.Locale.Tr "repo.pulls.nothing_to_compare_have_tag"}}
{{end}} {{else if and .PageIsComparePull (gt .CommitCount 0)}} {{if .HasPullRequest}}
{{template "shared/issueicon" .}}
{{RenderIssueTitle $.Context .PullRequest.Issue.Title ($.Repository.ComposeMetas ctx) | RenderCodeBlock}} #{{.PullRequest.Issue.Index}}
{{ctx.Locale.Tr "repo.pulls.view"}}
{{else}} {{if and $.IsSigned (not .Repository.IsArchived)}}
{{else if .Repository.IsArchived}}
{{if .Repository.ArchivedUnix.IsZero}} {{ctx.Locale.Tr "repo.archive.title"}} {{else}} {{ctx.Locale.Tr "repo.archive.title_date" (ctx.DateUtils.AbsoluteLong .Repository.ArchivedUnix)}} {{end}}
{{end}} {{if $.IsSigned}}
{{template "repo/issue/new_form" .}}
{{end}} {{$showDiffBox = true}} {{end}} {{else if not .IsNothingToCompare}} {{$showDiffBox = true}} {{end}}
{{if $showDiffBox}}
{{template "repo/commits_table" .}} {{template "repo/diff/box" .}}
{{end}}