{{define "branches"}} {{template "layout-start" .}}
{{if .CanWrite}}{{end}}
{{if and (not .Branch.Active) (not .Branch.Stale)}}

{{t "repo.noBranches"}}

{{else}} {{if .Branch.ShowActive}}

{{t "branch.group.active"}}

{{range .Branch.Active}}{{template "branchrow" .}}{{else}}

{{t "branch.none.active"}}

{{end}}
{{end}} {{if .Branch.ShowStale}}

{{t "branch.group.stale"}}

{{range .Branch.Stale}}{{template "branchrow" .}}{{else}}

{{t "branch.none.stale"}}

{{end}}
{{end}} {{end}} {{if .CanWrite}}

{{t "branch.create"}}

{{range .Branches}}{{end}} {{range .Tags}}{{end}}

{{t "branch.delete"}}

{{t "branch.rename"}}

{{end}} {{template "layout-end" .}} {{end}} {{define "branchrow"}}
{{.Name}} {{if .Default}}{{t "branch.default"}}{{end}} {{if .Protected}}{{t "vis.protected"}}{{end}}

{{if .SHA}}{{.Short}}{{end}} {{if .Subject}}{{if .SHA}}{{end}}{{.Subject}}{{end}} {{if .When}}{{if or .SHA .Subject}}{{end}}{{.When}}{{end}} {{if .PipeStatus}}{{.PipeLabel}}{{end}}

{{if not .Default}} {{if and (eq .Ahead 0) (eq .Behind 0)}}{{t "branch.even"}}{{else}} {{if .Ahead}}{{t "branch.ahead" .Ahead}}{{end}} {{if .Behind}}{{t "branch.behind" .Behind}}{{end}} {{end}} {{range .OpenMRs}}!{{.}}{{else}} {{t "branch.makeMR"}} {{end}} {{end}}
{{if .CanEdit}}
⋯
{{end}}
{{end}}