summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-05-12 06:52:46 +0100
committerGitHub <noreply@github.com>2020-05-12 08:52:46 +0300
commit0198bbedc193fd1c5733fede11a57b7900cf6c8c (patch)
treec5be4250e0191f3f027a2d82655d56adc7e84c9e /templates
parenta4c7ad99e54d0835f759199599a8dcd6f5d7e90e (diff)
downloadgitea-0198bbedc193fd1c5733fede11a57b7900cf6c8c.tar.gz
gitea-0198bbedc193fd1c5733fede11a57b7900cf6c8c.zip
Allow compare page to look up base, head, own-fork, forkbase-of-head (#11327)
* 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>
Diffstat (limited to 'templates')
-rw-r--r--templates/repo/diff/compare.tmpl35
1 files changed, 30 insertions, 5 deletions
diff --git a/templates/repo/diff/compare.tmpl b/templates/repo/diff/compare.tmpl
index 35a37ab761..1859af68d0 100644
--- a/templates/repo/diff/compare.tmpl
+++ b/templates/repo/diff/compare.tmpl
@@ -26,11 +26,21 @@
</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}}:{{end}}{{EscapePound $.HeadBranch}}">{{$.BaseName}}:{{.}}</div>
+ <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 .Repository.IsFork}}
- {{range .BaseRepoBranches}}
- <div class="item" data-url="{{$.PullRequestCtx.BaseRepo.Link}}/compare/{{EscapePound .}}...{{$.HeadUser.Name}}:{{EscapePound $.HeadBranch}}">{{$.PullRequestCtx.BaseRepo.OwnerName}}:{{.}}</div>
+ {{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>
@@ -49,7 +59,22 @@
</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}}:{{end}}{{EscapePound .}}">{{$.HeadUser.Name}}:{{.}}</div>
+ <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>