mirror of
https://github.com/go-gitea/gitea.git
synced 2024-11-25 11:39:43 +08:00
0198bbedc1
* Allow compare page to look up base, head, own-fork, forkbase-of-head Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @guillep2k Signed-off-by: Andrew Thornton <art27@cantab.net> * Update routers/repo/compare.go * as per @guillep2k Signed-off-by: Andrew Thornton <art27@cantab.net> * Rationalise the names a little Signed-off-by: Andrew Thornton <art27@cantab.net> * Rationalise the names a little (2) Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix 500 with fork of fork Signed-off-by: Andrew Thornton <art27@cantab.net> * Prevent 500 on compare different trees Signed-off-by: Andrew Thornton <art27@cantab.net> * dotdotdot is perfectly valid in both usernames and repo names Signed-off-by: Andrew Thornton <art27@cantab.net> * ensure we can set the head and base repos too Signed-off-by: Andrew Thornton <art27@cantab.net> * ensure we can set the head and base repos too (2) Signed-off-by: Andrew Thornton <art27@cantab.net> * fix lint Signed-off-by: Andrew Thornton <art27@cantab.net> * only set headRepo == baseRepo if isSameRepo Signed-off-by: Andrew Thornton <art27@cantab.net>
117 lines
4.9 KiB
Cheetah
117 lines
4.9 KiB
Cheetah
{{template "base/head" .}}
|
|
<div class="repository diff {{if .PageIsComparePull}}compare pull{{end}}">
|
|
{{template "repo/header" .}}
|
|
<div class="ui container {{if .IsSplitStyle}}fluid padded{{end}}">
|
|
|
|
{{if .PageIsComparePull}}
|
|
<h2 class="ui header">
|
|
{{if and $.IsSigned (not .Repository.IsArchived)}}
|
|
{{.i18n.Tr "repo.pulls.compare_changes"}}
|
|
<div class="sub header">{{.i18n.Tr "repo.pulls.compare_changes_desc"}}</div>
|
|
{{ else }}
|
|
{{.i18n.Tr "action.compare_commits_general"}}
|
|
{{ end }}
|
|
</h2>
|
|
<div class="ui segment choose branch">
|
|
{{svg "octicon-git-compare" 16}}
|
|
<div class="ui floating filter dropdown" data-no-results="{{.i18n.Tr "repo.pulls.no_results"}}">
|
|
<div class="ui basic small button">
|
|
<span class="text">{{.i18n.Tr "repo.pulls.compare_base"}}: {{$.BaseName}}:{{$.BaseBranch}}</span>
|
|
<i class="dropdown icon"></i>
|
|
</div>
|
|
<div class="menu">
|
|
<div class="ui icon search input">
|
|
<i class="filter icon"></i>
|
|
<input name="search" placeholder="{{.i18n.Tr "repo.pulls.filter_branch"}}...">
|
|
</div>
|
|
<div class="scrolling menu">
|
|
{{range .Branches}}
|
|
<div class="item {{if eq $.BaseBranch .}}selected{{end}}" data-url="{{$.RepoLink}}/compare/{{EscapePound .}}...{{if not $.PullRequestCtx.SameRepo}}{{$.HeadUser.Name}}/{{$.HeadRepo.Name}}:{{end}}{{EscapePound $.HeadBranch}}">{{$.BaseName}}:{{.}}</div>
|
|
{{end}}
|
|
{{if not .PullRequestCtx.SameRepo}}
|
|
{{range .HeadBranches}}
|
|
<div class="item" data-url="{{$.HeadRepo.Link}}/compare/{{EscapePound .}}...{{$.HeadUser.Name}}/{{$.HeadRepo.Name}}:{{EscapePound $.HeadBranch}}">{{$.HeadUser.Name}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
{{if .OwnForkRepo}}
|
|
{{range .OwnForkRepoBranches}}
|
|
<div class="item" data-url="{{$.OwnForkRepo.Link}}/compare/{{EscapePound .}}...{{$.HeadUser.Name}}/{{$.HeadRepo.Name}}:{{EscapePound $.HeadBranch}}">{{$.OwnForkRepo.OwnerName}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
{{if .RootRepo}}
|
|
{{range .RootRepoBranches}}
|
|
<div class="item" data-url="{{$.RootRepo.Link}}/compare/{{EscapePound .}}...{{$.HeadUser.Name}}/{{$.HeadRepo.Name}}:{{EscapePound $.HeadBranch}}">{{$.RootRepo.OwnerName}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
...
|
|
<div class="ui floating filter dropdown">
|
|
<div class="ui basic small button">
|
|
<span class="text">{{.i18n.Tr "repo.pulls.compare_compare"}}: {{$.HeadUser.Name}}:{{$.HeadBranch}}</span>
|
|
<i class="dropdown icon"></i>
|
|
</div>
|
|
<div class="menu">
|
|
<div class="ui icon search input">
|
|
<i class="filter icon"></i>
|
|
<input name="search" placeholder="{{.i18n.Tr "repo.pulls.filter_branch"}}...">
|
|
</div>
|
|
<div class="scrolling menu">
|
|
{{range .HeadBranches}}
|
|
<div class="{{if eq $.HeadBranch .}}selected{{end}} item" data-url="{{$.RepoLink}}/compare/{{EscapePound $.BaseBranch}}...{{if not $.PullRequestCtx.SameRepo}}{{$.HeadUser.Name}}/{{$.HeadRepo.Name}}:{{end}}{{EscapePound .}}">{{$.HeadUser.Name}}:{{.}}</div>
|
|
{{end}}
|
|
{{if not .PullRequestCtx.SameRepo}}
|
|
{{range .Branches}}
|
|
<div class="item" data-url="{{$.RepoLink}}/compare/{{EscapePound $.BaseBranch}}...{{$.BaseName}}/{{$.Repository.Name}}:{{EscapePound .}}">{{$.BaseName}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
{{if .OwnForkRepo}}
|
|
{{range .OwnForkRepoBranches}}
|
|
<div class="item" data-url="{{$.RepoLink}}/compare/{{EscapePound $.BaseBranch}}...{{$.OwnForkRepo.OwnerName}}/{{$.OwnForkRepo.Name}}:{{EscapePound .}}">{{$.OwnForkRepo.OwnerName}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
{{if .RootRepo}}
|
|
{{range .RootRepoBranches}}
|
|
<div class="item" data-url="{{$.RepoLink}}/compare/{{EscapePound $.BaseBranch}}...{{$.RootRepo.OwnerName}}/{{$.RootRepo.Name}}:{{EscapePound .}}">{{$.RootRepo.OwnerName}}:{{.}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
|
|
{{if .IsNothingToCompare}}
|
|
<div class="ui segment">{{.i18n.Tr "repo.pulls.nothing_to_compare"}}</div>
|
|
{{else if and .PageIsComparePull (gt .CommitCount 0)}}
|
|
{{if .HasPullRequest}}
|
|
<div class="ui segment">
|
|
{{.i18n.Tr "repo.pulls.has_pull_request" $.RepoLink $.RepoRelPath .PullRequest.Index | Safe}}
|
|
</div>
|
|
{{else}}
|
|
{{if and $.IsSigned (not .Repository.IsArchived)}}
|
|
<div class="ui info message show-form-container">
|
|
<button class="ui button green show-form">{{.i18n.Tr "repo.pulls.new"}}</button>
|
|
</div>
|
|
{{else if .Repository.IsArchived}}
|
|
<div class="ui warning message">
|
|
{{.i18n.Tr "repo.archive.title"}}
|
|
</div>
|
|
{{end}}
|
|
{{if $.IsSigned}}
|
|
<div class="pullrequest-form" style="display: none">
|
|
{{template "repo/issue/new_form" .}}
|
|
</div>
|
|
{{end}}
|
|
{{template "repo/commits_table" .}}
|
|
{{template "repo/diff/box" .}}
|
|
{{end}}
|
|
{{else}}
|
|
{{template "repo/commits_table" .}}
|
|
{{template "repo/diff/box" .}}
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{template "base/footer" .}}
|