| @@ -1,20 +1,10 @@ |
| 1 | {{define "mrrange"}}<code>{{if .SourcePath}}{{.SourcePath}}:{{end}}{{.SourceRef}}</code> into <code>{{.TargetRef}}</code>{{end}} |
| |
| 2 | {{define "title"}}!{{.MR.Number}} · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}} |
1 | {{define "title"}}!{{.MR.Number}} · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}} |
| 3 | {{define "content"}} |
2 | {{define "content"}} |
| 4 | {{$base := printf "/%s/%s/mrs/%d" .Repo.OwnerName .Repo.Name .MR.Number}} |
3 | {{$base := printf "/%s/%s/mrs/%d" .Repo.OwnerName .Repo.Name .MR.Number}} |
| 5 | <h1 class="issuetitle">{{.MR.Title}} <span class="issuenumber">!{{.MR.Number}}</span></h1> |
4 | <h1 class="issuetitle">{{.MR.Title}} <span class="issuenumber">!{{.MR.Number}}</span></h1> |
| 6 | <p class="issuemeta">{{if .MR.Draft}}<span class="chip chip-neutral">draft</span> {{end}}<span class="chip chip-{{.MR.State}}">{{.MR.State}}</span> |
5 | <p class="issuemeta"><span class="chip chip-{{.MR.State}}">{{if eq .MR.State "source_gone"}}source gone{{else}}{{.MR.State}}{{end}}</span>{{if .MR.Draft}} <span class="chip chip-neutral">draft</span>{{end}} |
| 7 | {{if and (eq .MR.State "merged") .MR.MergedAt}} |
6 | {{if eq .MR.State "merged"}}merged by <a href="/{{.MR.MergedBy}}">{{.MR.MergedBy}}</a> on {{when .MR.MergedAt}}{{else if eq .MR.State "closed"}}closed without merging by <a href="/{{.MR.ClosedBy}}">{{.MR.ClosedBy}}</a> on {{when .MR.ClosedAt}}{{else}}opened by <a href="/{{.MR.Author}}">{{.MR.Author}}</a> on {{when .MR.CreatedAt}}{{end}} |
| 8 | {{if .MR.MergedBy}}<a href="/{{.MR.MergedBy}}">{{.MR.MergedBy}}</a> merged{{else}}Merged{{end}} |
7 | · <code>{{.MR.SourceRef}}</code> into <code>{{.MR.TargetRef}}</code></p> |
| 9 | {{template "mrrange" .MR}} on {{when .MR.MergedAt}} |
| |
| 10 | {{else if and (eq .MR.State "closed") .MR.ClosedAt}} |
| |
| 11 | {{if .MR.ClosedBy}}<a href="/{{.MR.ClosedBy}}">{{.MR.ClosedBy}}</a> closed this{{else}}Closed{{end}} |
| |
| 12 | without merging {{template "mrrange" .MR}} on {{when .MR.ClosedAt}} |
| |
| 13 | {{else if or (eq .MR.State "merged") (eq .MR.State "closed")}} |
| |
| 14 | {{template "mrrange" .MR}} |
| |
| 15 | {{else}} |
| |
| 16 | <a href="/{{.MR.Author}}">{{.MR.Author}}</a> wants to merge {{template "mrrange" .MR}} |
| |
| 17 | {{end}}</p> |
| |
| 18 | {{with field . "StackedOn"}}<p class="meta">Stacked on <a href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/mrs/{{.Number}}">!{{.Number}} {{.Title}}</a>: merges into its branch until that lands, then onto its target.</p>{{end}} |
8 | {{with field . "StackedOn"}}<p class="meta">Stacked on <a href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/mrs/{{.Number}}">!{{.Number}} {{.Title}}</a>: merges into its branch until that lands, then onto its target.</p>{{end}} |
| 19 | {{with field . "Stacked"}}<p class="meta">Builds on this: {{range $i, $k := .}}{{if $i}}, {{end}}<a href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/mrs/{{$k.Number}}">!{{$k.Number}} {{$k.Title}}</a>{{end}}. Merging with squash or rebase is refused while they are open.</p>{{end}} |
9 | {{with field . "Stacked"}}<p class="meta">Builds on this: {{range $i, $k := .}}{{if $i}}, {{end}}<a href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/mrs/{{$k.Number}}">!{{$k.Number}} {{$k.Title}}</a>{{end}}. Merging with squash or rebase is refused while they are open.</p>{{end}} |
| 20 | |
10 | |
| @@ -30,6 +20,7 @@ |
| 30 | </nav> |
20 | </nav> |
| 31 | |
21 | |
| 32 | {{if eq .View "conversation"}} |
22 | {{if eq .View "conversation"}} |
| |
23 | <div class="prose"> |
| 33 | {{if .CanEdit}}<details class="editbox"><summary>Edit</summary> |
24 | {{if .CanEdit}}<details class="editbox"><summary>Edit</summary> |
| 34 | <form method="post" action="{{$base}}/edit" class="commentform"> |
25 | <form method="post" action="{{$base}}/edit" class="commentform"> |
| 35 | <p><input type="text" name="title" aria-label="Title" value="{{.MR.Title}}" required></p> |
26 | <p><input type="text" name="title" aria-label="Title" value="{{.MR.Title}}" required></p> |
| @@ -55,6 +46,7 @@ |
| 55 | <p><button type="submit" class="btn">Comment</button></p> |
46 | <p><button type="submit" class="btn">Comment</button></p> |
| 56 | </form> |
47 | </form> |
| 57 | {{end}} |
48 | {{end}} |
| |
49 | </div> |
| 58 | |
50 | |
| 59 | {{else if eq .View "commits"}} |
51 | {{else if eq .View "commits"}} |
| 60 | {{if gt .CommitsTotal (len .Commits)}}<p class="meta">first {{len .Commits}} of {{.CommitsTotal}} commits; the rest are in the branch</p>{{end}} |
52 | {{if gt .CommitsTotal (len .Commits)}}<p class="meta">first {{len .Commits}} of {{.CommitsTotal}} commits; the rest are in the branch</p>{{end}} |
| @@ -74,9 +66,10 @@ |
| 74 | </ul> |
66 | </ul> |
| 75 | |
67 | |
| 76 | {{else}} |
68 | {{else}} |
| 77 | <p class="diffstat">{{.Stat.Files}} file{{if ne .Stat.Files 1}}s{{end}} changed, <span class="add">+{{.Stat.Adds}}</span> <span class="del">−{{.Stat.Dels}}</span>{{if .DiffTruncated}} · shown up to 4 MiB; the counts and the last file are partial{{end}}</p> |
69 | {{if .DiffFiles}}<p class="diffstat">{{.Stat.Files}} file{{if ne .Stat.Files 1}}s{{end}} changed, <span class="add">+{{.Stat.Adds}}</span> <span class="del">−{{.Stat.Dels}}</span>{{if .DiffTruncated}} · shown up to 4 MiB; the counts and the last file are partial{{end}}</p> |
| 78 | {{if .DiffTruncated}}<p class="error" role="alert">This diff is larger than 4 MiB and is cut off below. Fetch the branch to see all of it.</p>{{end}} |
70 | {{if .DiffTruncated}}<p class="error" role="alert">This diff is larger than 4 MiB and is cut off below. Fetch the branch to see all of it.</p>{{end}} |
| 79 | {{template "difffiles" dict "Files" .DiffFiles "Base" $base "Viewer" .Viewer}} |
71 | {{template "difffiles" dict "Files" .DiffFiles "Base" $base "Viewer" .Viewer}} |
| |
72 | {{else}}<p class="empty-note">No changes between the source and target.{{if .HeadMerged}} The source branch was already merged or fast-forwarded into <code>{{.MR.TargetRef}}</code>.{{end}}</p>{{end}} |
| 80 | {{end}} |
73 | {{end}} |
| 81 | |
74 | |
| 82 | </div> |
75 | </div> |
| @@ -113,38 +106,6 @@ |
| 113 | </form> |
106 | </form> |
| 114 | </div> |
107 | </div> |
| 115 | {{end}} |
108 | {{end}} |
| 116 | {{if and .CanEdit (or (eq .MR.State "open") (eq .MR.State "source_gone"))}} |
| |
| 117 | <div class="grp"> |
| |
| 118 | <h2>Target</h2> |
| |
| 119 | <form method="post" action="{{$base}}/retarget" class="actions"> |
| |
| 120 | <label class="none" for="target">Branch</label> |
| |
| 121 | <select id="target" name="target"> |
| |
| 122 | {{range .Branches}}<option value="{{.Name}}"{{if eq .Name $.MR.TargetRef}} selected{{end}}>{{.Name}}</option>{{end}} |
| |
| 123 | </select> |
| |
| 124 | <button type="submit" class="btn">Retarget</button> |
| |
| 125 | </form> |
| |
| 126 | <p class="row none">Retargeting stales existing reviews.</p> |
| |
| 127 | </div> |
| |
| 128 | {{end}} |
| |
| 129 | <div class="grp"> |
| |
| 130 | <h2>Reviewers</h2> |
| |
| 131 | {{if .MR.ReviewRequests}}<p class="row">{{range .MR.ReviewRequests}}<a href="/{{.}}">{{.}}</a> {{end}}</p> |
| |
| 132 | {{else}}<p class="none">nobody yet</p>{{end}} |
| |
| 133 | {{if and .CanWrite (or (eq .MR.State "open") (eq .MR.State "source_gone"))}} |
| |
| 134 | <form method="post" action="{{$base}}/review-request" class="actions"> |
| |
| 135 | <input type="text" name="add" aria-label="Add reviewers" placeholder="add, space-separated"> |
| |
| 136 | <input type="text" name="remove" aria-label="Remove reviewers" placeholder="remove"> |
| |
| 137 | <button type="submit" class="btn">Apply</button> |
| |
| 138 | </form> |
| |
| 139 | {{end}} |
| |
| 140 | </div> |
| |
| 141 | <div class="grp"> |
| |
| 142 | <h2>Reviews</h2> |
| |
| 143 | {{range .Reviews}}<p class="row"><span class="dot {{if eq .Verdict "approve"}}ok{{else}}pend{{end}}"></span><a href="/{{.Reviewer}}">{{.Reviewer}}</a> {{.Verdict}}{{if .Stale}} <span class="chip chip-stale">stale</span>{{end}}{{if not .Counts}} <span class="chip chip-neutral" title="This reviewer has no write access, so the merge gates do not count it">advisory</span>{{end}}<span class="sub">{{when .CreatedAt}}</span></p> |
| |
| 144 | {{else}}<p class="none">none yet</p>{{end}} |
| |
| 145 | {{if gt (len .Revisions) 1}}<p class="row none">{{len .Revisions}} revisions pushed. What changed between the last two: |
| |
| 146 | <code>gitbay mr range-diff {{.Repo.OwnerName}}/{{.Repo.Name}} {{.MR.Number}}</code></p>{{end}} |
| |
| 147 | </div> |
| |
| 148 | {{with .Gates}}<div class="grp"> |
109 | {{with .Gates}}<div class="grp"> |
| 149 | <h2>Merge gates</h2> |
110 | <h2>Merge gates</h2> |
| 150 | {{if .Unmet}}{{range .Unmet}}<p class="row"><span class="dot bad"></span>{{.}}</p>{{end}} |
111 | {{if .Unmet}}{{range .Unmet}}<p class="row"><span class="dot bad"></span>{{.}}</p>{{end}} |
| @@ -160,9 +121,38 @@ |
| 160 | {{else}}<p class="none">No checks reported</p>{{end}} |
121 | {{else}}<p class="none">No checks reported</p>{{end}} |
| 161 | </div> |
122 | </div> |
| 162 | <div class="grp"> |
123 | <div class="grp"> |
| 163 | <h2>Source</h2> |
124 | <h2>Reviews</h2> |
| 164 | <p class="row"><code>{{if .MR.SourcePath}}{{.MR.SourcePath}}:{{end}}{{.MR.SourceRef}}</code></p> |
125 | {{range .Reviews}}<p class="row"><span class="dot {{if eq .Verdict "approve"}}ok{{else}}pend{{end}}"></span><a href="/{{.Reviewer}}">{{.Reviewer}}</a> {{.Verdict}}{{if .Stale}} <span class="chip chip-stale">stale</span>{{end}}{{if not .Counts}} <span class="chip chip-neutral" title="This reviewer has no write access, so the merge gates do not count it">advisory</span>{{end}}<span class="sub">{{when .CreatedAt}}</span></p> |
| 165 | <p class="row none">into <code>{{.MR.TargetRef}}</code> · {{if eq .MR.State "merged"}}merged at{{else}}head{{end}} <code>{{short .MR.HeadSHA}}</code>{{if .SourceGone}} · <span class="chip chip-neutral">branch deleted</span>{{end}}</p> |
126 | {{else}}<p class="none">none yet</p>{{end}} |
| |
127 | {{if gt (len .Revisions) 1}}<p class="row none">{{len .Revisions}} revisions pushed. What changed between the last two: |
| |
128 | <code>gitbay mr range-diff {{.Repo.OwnerName}}/{{.Repo.Name}} {{.MR.Number}}</code></p>{{end}} |
| |
129 | </div> |
| |
130 | <div class="grp"> |
| |
131 | <h2>Reviewers</h2> |
| |
132 | {{if .MR.ReviewRequests}}<p class="row">{{range .MR.ReviewRequests}}<a href="/{{.}}">{{.}}</a> {{end}}</p> |
| |
133 | {{else}}<p class="none">nobody yet</p>{{end}} |
| |
134 | {{if and .CanWrite (or (eq .MR.State "open") (eq .MR.State "source_gone"))}} |
| |
135 | <form method="post" action="{{$base}}/review-request" class="actions"> |
| |
136 | <input type="text" name="add" aria-label="Add reviewers" placeholder="add, space-separated"> |
| |
137 | <input type="text" name="remove" aria-label="Remove reviewers" placeholder="remove"> |
| |
138 | <button type="submit" class="btn">Apply</button> |
| |
139 | </form> |
| |
140 | {{end}} |
| |
141 | </div> |
| |
142 | <div class="grp"> |
| |
143 | <h2>Source and target</h2> |
| |
144 | <p class="row"><code>{{if .MR.SourcePath}}{{.MR.SourcePath}}:{{end}}{{.MR.SourceRef}}</code> into <code>{{.MR.TargetRef}}</code></p> |
| |
145 | <p class="row none">{{if eq .MR.State "merged"}}merged at{{else}}head{{end}} <code>{{short .MR.HeadSHA}}</code>{{if .Base}} · base <code>{{short .Base}}</code>{{end}}{{if .SourceGone}} · <span class="chip chip-neutral">branch deleted</span>{{end}}</p> |
| |
146 | {{if and .CanEdit (or (eq .MR.State "open") (eq .MR.State "source_gone"))}} |
| |
147 | <form method="post" action="{{$base}}/retarget" class="actions"> |
| |
148 | <label class="none" for="target">Branch</label> |
| |
149 | <select id="target" name="target"> |
| |
150 | {{range .Branches}}<option value="{{.Name}}"{{if eq .Name $.MR.TargetRef}} selected{{end}}>{{.Name}}</option>{{end}} |
| |
151 | </select> |
| |
152 | <button type="submit" class="btn">Retarget</button> |
| |
153 | </form> |
| |
154 | <p class="row none">Retargeting stales existing reviews.</p> |
| |
155 | {{end}} |
| 166 | </div> |
156 | </div> |
| 167 | {{if .MR.Milestone}}<div class="grp"> |
157 | {{if .MR.Milestone}}<div class="grp"> |
| 168 | <h2>Milestone</h2> |
158 | <h2>Milestone</h2> |