{{template "repo/header" .}} {{$compareSeparator := $.CompareInfo.CompareSeparator}} {{$compareSeparatorSwitch := Iif $.CompareInfo.DirectComparison "..." ".."}}

{{if and $.PageIsComparePull $.IsSigned (not .Repository.IsArchived)}} {{ctx.Locale.Tr "repo.compare.title"}}
{{ctx.Locale.Tr "repo.compare.description"}}
{{else}} {{ctx.Locale.Tr "action.compare_commits_general"}} {{end}}

{{template "base/alert" .}} {{$BaseCompareName := $.Repository.FullName -}} {{$HeadCompareName := $.HeadRepo.FullName -}} {{$OwnForkCompareName := "" -}} {{if $.OwnForkRepo -}} {{$OwnForkCompareName = $.OwnForkRepo.FullName -}} {{end -}} {{$RootRepoCompareName := "" -}} {{if $.RootRepo -}} {{$RootRepoCompareName = $.RootRepo.FullName -}} {{end -}}
{{svg "octicon-git-compare"}} {{svg "octicon-arrow-left" 16}}
{{$compareSeparator}}
{{$showDiffBox := and .CommitCount (not .IsNothingToCompare)}} {{if and .IsSigned .PageIsComparePull}} {{$allowCreatePR := and ($.CompareInfo.BaseRef.IsBranch) ($.CompareInfo.HeadRef.IsBranch) (not $.CompareInfo.DirectComparison) (or $.AllowEmptyPr (not .IsNothingToCompare))}} {{if .IsNothingToCompare}}
{{if $allowCreatePR}} {{ctx.Locale.Tr "repo.pulls.nothing_to_compare_and_allow_empty_pr"}} {{else if and $.CompareInfo.BaseRef.IsBranch $.CompareInfo.HeadRef.IsBranch}} {{ctx.Locale.Tr "repo.pulls.nothing_to_compare"}} {{else}} {{ctx.Locale.Tr "repo.pulls.nothing_to_compare_have_tag"}} {{end}}
{{end}} {{if .HasPullRequest}}
{{template "shared/issueicon" .}}
{{ctx.RenderUtils.RenderIssueTitle .PullRequest.Issue.Title $.Repository}} #{{.PullRequest.Issue.Index}}
{{ctx.Locale.Tr "repo.pulls.view"}}
{{else if .Repository.IsArchived}}
{{if .Repository.ArchivedUnix.IsZero}} {{ctx.Locale.Tr "repo.archive.title"}} {{else}} {{ctx.Locale.Tr "repo.archive.title_date" (DateUtils.AbsoluteLong .Repository.ArchivedUnix)}} {{end}}
{{else if $allowCreatePR}}
{{ctx.Locale.Tr "repo.pulls.new.description"}} {{ctx.Locale.Tr "repo.pulls.new"}}
{{template "repo/issue/new_form" .}}
{{end}} {{else}}{{/* not signed-in or not for pull-request */}} {{if and (not .CommitCount) $.CompareInfo.CompareBase}}
{{ctx.Locale.Tr "repo.commits.nothing_to_compare"}}
{{end}} {{end}}
{{if $showDiffBox}}
{{template "repo/commits_table" .}} {{template "repo/diff/box" .}}
{{end}}