blob: 4fc4b99a963b53e6d6159583c4e9e351fedb2e29 [file] [log] [blame]
Dave Borowitz9de65952012-08-13 16:09:45 -07001// Copyright 2012 Google Inc. All Rights Reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
Jakub Vranabd9924f2017-09-29 12:14:48 -070014{namespace gitiles}
Dave Borowitz9de65952012-08-13 16:09:45 -070015
16/**
17 * Detailed listing of a commit.
Dave Borowitz9de65952012-08-13 16:09:45 -070018 */
Jesse Costello-Good6f62c5d2021-02-02 12:05:06 -080019{template commitDetail}
Jakub Vranaf525cef2019-03-04 11:21:52 +010020 {@param author: ?} /** map with "name", "email", and "time" keys for the commit author. */
21 {@param committer: ?} /** map with "name", "email", and "time" keys for the committer. */
22 {@param sha: ?} /** commit SHA-1. */
23 {@param tree: ?} /** tree SHA-1. */
24 {@param treeUrl: ?} /** tree URL. */
Jakub Vranad5e46bc2019-12-05 13:31:54 +010025 {@param parents: ?} /** list of parent objects with the following keys:
26 sha: SHA-1.
27 url: URL to view the parent commit.
28 diffUrl: URL to display diffs relative to this parent.
29 blameUrl: optional URL to display blame of a file at this parent.
30 */
31 {@param message: ?} /** list of commit message parts, where each part contains:
32 text: raw text of the part.
33 url: optional URL that should be linked to from the part.
34 */
Pontus Jaenssonc144de92021-10-29 11:13:23 +020035 {@param notes: ?} /** the notes for the corresponding commit */
Jakub Vranad5e46bc2019-12-05 13:31:54 +010036 {@param diffTree: ?} /** list of changed tree entries with the following keys:
37 changeType: string matching an org.eclipse.jgit.diff.DiffEntry.ChangeType constant.
38 path: (new) path of the tree entry.
39 oldPath: old path, only for renames and copies.
40 url: URL to a detail page for the tree entry.
41 diffUrl: URL to a diff page for the tree entry's diff in this commit.
42 */
Jakub Vranaf525cef2019-03-04 11:21:52 +010043 {@param logUrl: ?} /** URL to a log page starting at this commit. */
44 {@param archiveUrl: ?} /** URL to a download link of this commit as an archive. */
45 {@param archiveType: ?} /** type of the archive to download. */
Andrew Bonventre0ffb2822015-09-16 15:28:02 -040046<div class="u-monospace Metadata">
Dave Borowitz9de65952012-08-13 16:09:45 -070047 <table>
48 <tr>
Andrew Bonventreb33426e2015-09-09 18:28:28 -040049 <th class="Metadata-title">{msg desc="Header for commit SHA entry"}commit{/msg}</th>
50 <td>
Dave Borowitz9de65952012-08-13 16:09:45 -070051 {$sha}
Andrew Bonventreb33426e2015-09-09 18:28:28 -040052 </td>
53 <td>
54 <span>
Dave Borowitz9de65952012-08-13 16:09:45 -070055 [<a href="{$logUrl}">{msg desc="text for the log link"}log{/msg}</a>]
56 </span>
Andrew Bonventreb33426e2015-09-09 18:28:28 -040057 {sp}<span>[<a href="{$archiveUrl}">{$archiveType}</a>]</span>
Dave Borowitz9de65952012-08-13 16:09:45 -070058 </td>
Dave Borowitz9de65952012-08-13 16:09:45 -070059 </tr>
60 <tr>
Andrew Bonventreb33426e2015-09-09 18:28:28 -040061 <th class="Metadata-title">{msg desc="Header for commit author"}author{/msg}</th>
Jesse Costello-Good6f62c5d2021-02-02 12:05:06 -080062 <td>
63 {call person_ data="$author" /}
64 </td>
Dave Borowitz9de65952012-08-13 16:09:45 -070065 <td>{$author.time}</td>
66 </tr>
67 <tr>
Andrew Bonventreb33426e2015-09-09 18:28:28 -040068 <th class="Metadata-title">{msg desc="Header for committer"}committer{/msg}</th>
Jesse Costello-Good6f62c5d2021-02-02 12:05:06 -080069 <td>
70 {call person_ data="$committer" /}
71 </td>
Dave Borowitz9de65952012-08-13 16:09:45 -070072 <td>{$committer.time}</td>
73 </tr>
74 <tr>
Andrew Bonventreb33426e2015-09-09 18:28:28 -040075 <th class="Metadata-title">{msg desc="Header for tree SHA entry"}tree{/msg}</th>
76 <td><a href="{$treeUrl}">{$tree}</a></td>
Dave Borowitz9de65952012-08-13 16:09:45 -070077 </tr>
Luke Sandberg9645f0f2017-12-22 11:08:35 -080078 {for $parent in $parents}
Dave Borowitz9de65952012-08-13 16:09:45 -070079 <tr>
Andrew Bonventreb33426e2015-09-09 18:28:28 -040080 <th class="Metadata-title">{msg desc="Header for parent SHA"}parent{/msg}</th>
Dave Borowitz9de65952012-08-13 16:09:45 -070081 <td>
82 <a href="{$parent.url}">{$parent.sha}</a>
Andrew Bonventreb33426e2015-09-09 18:28:28 -040083 {sp}<span>
Dave Borowitz9de65952012-08-13 16:09:45 -070084 [<a href="{$parent.diffUrl}">{msg desc="text for the parent diff link"}diff{/msg}</a>]
Jesse Costello-Good359830c2021-06-15 16:26:12 -070085 {if $parent.blameUrl != null}
Dave Borowitzf03fcea2014-04-21 17:20:33 -070086 {sp}[<a href="{$parent.blameUrl}">{msg desc="text for the parent blame link"}blame{/msg}</a>]
87 {/if}
Dave Borowitz9de65952012-08-13 16:09:45 -070088 </span>
89 </td>
90 </tr>
Luke Sandberg9645f0f2017-12-22 11:08:35 -080091 {/for}
Dave Borowitz9de65952012-08-13 16:09:45 -070092 </table>
93</div>
Jesse Costello-Good6f62c5d2021-02-02 12:05:06 -080094{call message_}
Andrew Bonventre0ffb2822015-09-16 15:28:02 -040095 {param className: 'u-pre u-monospace MetadataMessage' /}
Dave Borowitz9de65952012-08-13 16:09:45 -070096 {param message: $message /}
97{/call}
98
Pontus Jaenssonc144de92021-10-29 11:13:23 +020099{if $notes}
100 <h4>Notes:</h4>
101 <div class="MetadataMessage">
102 <span>
103 {msg desc="Text for the git notes"}{$notes}{/msg}
104 </span>
105 </div>
106{/if}
107
Dave Borowitz9de65952012-08-13 16:09:45 -0700108{if $diffTree and length($diffTree)}
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400109 <ul class="DiffTree">
Luke Sandberg9645f0f2017-12-22 11:08:35 -0800110 {for $entry in $diffTree}
Dave Borowitz9de65952012-08-13 16:09:45 -0700111 <li>
112 <a href="{$entry.url}">{$entry.path}</a>
113 {switch $entry.changeType}
114 {case 'ADD'}
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400115 <span class="DiffTree-action DiffTree-action--add">
Dave Borowitz9de65952012-08-13 16:09:45 -0700116 {msg desc="Text for a new tree entry"}
117 [Added - <a href="{$entry.diffUrl}">diff</a>]
118 {/msg}
119 </span>
120 {case 'MODIFY'}
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400121 <span class="DiffTree-action DiffTree-action--modify">
Dave Borowitz9de65952012-08-13 16:09:45 -0700122 {msg desc="Text for a modified tree entry"}
123 [<a href="{$entry.diffUrl}">diff</a>]
124 {/msg}
125 </span>
126 {case 'DELETE'}
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400127 <span class="DiffTree-action DiffTree-action--delete">
Dave Borowitz9de65952012-08-13 16:09:45 -0700128 {msg desc="Text for a deleted tree entry"}
129 [Deleted - <a href="{$entry.diffUrl}">diff</a>]
130 {/msg}
131 </span>
132 {case 'RENAME'}
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400133 <span class="DiffTree-action DiffTree-action--rename">
Dave Borowitz9de65952012-08-13 16:09:45 -0700134 {msg desc="Text for a renamed tree entry"}
135 [Renamed from {$entry.oldPath} - <a href="{$entry.diffUrl}">diff</a>]
136 {/msg}
137 </span>
138 {case 'COPY'}
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400139 <span class="DiffTree-action DiffTree-action--copy">
Dave Borowitz9de65952012-08-13 16:09:45 -0700140 {msg desc="Text for a copied tree entry"}
141 [Copied from {$entry.oldPath} - <a href="{$entry.diffUrl}">diff</a>]
142 {/msg}
143 </span>
144 {default}
145 {/switch}
146 </li>
Luke Sandberg9645f0f2017-12-22 11:08:35 -0800147 {/for}
Dave Borowitz9de65952012-08-13 16:09:45 -0700148 </ul>
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400149 <div class="DiffSummary">
Dave Borowitz9de65952012-08-13 16:09:45 -0700150 {if length($diffTree) == 1}
151 {msg desc="1 file changed"}1 file changed{/msg}
152 {else}
153 {msg desc="number of files changed"}{length($diffTree)} files changed{/msg}
154 {/if}
155 </div>
156{/if}
157
158{/template}
159
160/**
161 * Detailed listing of a tree.
Dave Borowitz9de65952012-08-13 16:09:45 -0700162 */
Jesse Costello-Good6f62c5d2021-02-02 12:05:06 -0800163{template treeDetail}
Jakub Vranaf525cef2019-03-04 11:21:52 +0100164 {@param sha: ?} /** SHA of this path's tree. */
165 {@param? logUrl: ?} /** optional URL to a log for this path. */
166 {@param? archiveUrl: ?} /** optional URL to a download link of this tree as an archive. */
167 {@param? archiveType: ?} /** type of the archive to download, if archiveUrl is set. */
Jakub Vranad5e46bc2019-12-05 13:31:54 +0100168 {@param entries: ?} /** list of entries with the following keys:
169 type: entry type, matching one of the constant names defined in org.eclipse.jgit.lib.FileMode.
170 name: tree entry name.
171 url: URL to link to.
172 targetName: name of a symlink target, required only if type == 'SYMLINK'.
173 targetUrl: optional url of a symlink target, required only if type == 'SYMLINK'.
174 */
Jakub Vranaf525cef2019-03-04 11:21:52 +0100175 {@param? readmePath: ?} /** optional path of the selected README.md file. */
176 {@param? readmeHtml: ?} /** optional rendered README.md contents. */
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400177<div class="TreeDetail">
Andrew Bonventre0ffb2822015-09-16 15:28:02 -0400178 <div class="u-sha1 u-monospace TreeDetail-sha1">
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400179 {msg desc="SHA-1 for the path's tree"}tree: {$sha}{/msg}
180 {if $logUrl}{sp}[<a href="{$logUrl}">{msg desc="history for a path"}path history{/msg}</a>]{/if}
181 {if $archiveUrl}
182 {sp}<span>[<a href="{$archiveUrl}">{$archiveType}</a>]</span>
183 {/if}
184 </div>
185
186 {if length($entries)}
187 <ol class="FileList">
Luke Sandberg9645f0f2017-12-22 11:08:35 -0800188 {for $entry in $entries}
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400189 <li class="FileList-item{sp}
190 {switch $entry.type}
191 {case 'TREE'}FileList-item--gitTree
192 {case 'SYMLINK'}FileList-item--symlink
193 {case 'REGULAR_FILE'}FileList-item--regularFile
194 {case 'EXECUTABLE_FILE'}FileList-item--executableFile
195 {case 'GITLINK'}gitlink
196 {default}regular-file
197 {/switch}
198 " title="
199 {switch $entry.type}
200 {case 'TREE'}{msg desc="Alt text for tree icon"}Tree{/msg}
201 {case 'SYMLINK'}{msg desc="Alt text for symlink icon"}Symlink{/msg}
202 {case 'REGULAR_FILE'}{msg desc="Alt text for regular file icon"}Regular file{/msg}
203 {case 'EXECUTABLE_FILE'}
204 {msg desc="Alt text for executable file icon"}Executable file{/msg}
205 {case 'GITLINK'}
206 {msg desc="Alt text for git submodule link icon"}Git submodule link{/msg}
207 {default}{msg desc="Alt text for other file icon"}Other{/msg}
208 {/switch}
209 {sp}- {$entry.name}">
210 <a class="FileList-itemLink" href="{$entry.url}">{$entry.name}</a>
211 {if $entry.type == 'SYMLINK'}
212 {sp}&#x21e8;{sp}
213 {if $entry.targetUrl}
214 <a href="{$entry.targetUrl}">{$entry.targetName}</a>
215 {else}
216 {$entry.targetName}
217 {/if}
218 {/if}
219 // TODO(dborowitz): Something reasonable for gitlinks.
220 </li>
Luke Sandberg9645f0f2017-12-22 11:08:35 -0800221 {/for}
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400222 </ol>
223 {else}
224 <p>{msg desc="Informational text for when a tree is empty"}This tree is empty.{/msg}</p>
225 {/if}
226
227 {if $readmeHtml}
228 <div class="InlineReadme">
229 <div class="InlineReadme-path">{$readmePath}</div>
230 <div class="doc">{$readmeHtml}</div>
231 </div>
Dave Borowitzc782ebe2013-11-11 11:43:29 -0800232 {/if}
Dave Borowitz9de65952012-08-13 16:09:45 -0700233</div>
Dave Borowitz9de65952012-08-13 16:09:45 -0700234{/template}
235
236/**
Dave Borowitz7745e7f2014-04-27 19:47:47 -0600237 * Common header for a blob shared between detail, blame, etc. views.
Dave Borowitz7745e7f2014-04-27 19:47:47 -0600238 */
Jesse Costello-Good6f62c5d2021-02-02 12:05:06 -0800239{template blobHeader}
Jakub Vranaf525cef2019-03-04 11:21:52 +0100240 {@param sha: ?} /** SHA of this file's blob. */
241 {@param? fileUrl: ?} /** optional URL to a detail view of this file. */
242 {@param? logUrl: ?} /** optional URL to a log for this file. */
243 {@param? blameUrl: ?} /** optional URL to a blame for this file. */
244 {@param? docUrl: ?} /** optional URL to view rendered file. */
Andrew Bonventre0ffb2822015-09-16 15:28:02 -0400245<div class="u-sha1 u-monospace BlobSha1">
Dave Borowitz7745e7f2014-04-27 19:47:47 -0600246 {msg desc="SHA-1 for the file's blob"}blob: {$sha}{/msg}
247 {if $fileUrl}{sp}[<a href="{$fileUrl}">{msg desc="detail view of a file"}file{/msg}</a>]{/if}
248 {if $logUrl}{sp}[<a href="{$logUrl}">{msg desc="history for a file"}log{/msg}</a>]{/if}
249 {if $blameUrl}{sp}[<a href="{$blameUrl}">{msg desc="blame for a file"}blame{/msg}</a>]{/if}
Shawn Pearcefdd98f62015-02-12 10:04:07 -0800250 {if $docUrl}{sp}[<a href="{$docUrl}">{msg desc="view rendered file"}view{/msg}</a>]{/if}
Dave Borowitz7745e7f2014-04-27 19:47:47 -0600251</div>
252{/template}
253
254/**
Dave Borowitz9de65952012-08-13 16:09:45 -0700255 * Detailed listing of a blob.
Dave Borowitz6ec0c872014-01-29 13:59:37 -0800256 */
Jesse Costello-Good6f62c5d2021-02-02 12:05:06 -0800257{template blobDetail}
Jakub Vranaf525cef2019-03-04 11:21:52 +0100258 {@param sha: ?} /** SHA of this file's blob. */
259 {@param? logUrl: ?} /** optional URL to a log for this file. */
260 {@param? blameUrl: ?} /** optional URL to a blame for this file. */
261 {@param lines: ?} /** lines (may be empty), or null for a binary file. Each line is a list of
262 entries with "classes" and "text" fields for pretty-printed spans. */
263 {@param? size: ?} /** for binary files only, size in bytes. */
Jesse Costello-Good6f62c5d2021-02-02 12:05:06 -0800264 {call blobHeader data="all" /}
Dave Borowitz7745e7f2014-04-27 19:47:47 -0600265
Dave Borowitzec6a9cc2014-04-25 15:51:23 -0400266 {if $lines != null}
267 {if $lines}
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400268 <table class="FileContents">
Demetrb46c2532021-12-08 17:56:19 -0800269 {for $line, $index in $lines}
270 {let $n: $index + 1 /}
Andrew Bonventre0ffb2822015-09-16 15:28:02 -0400271 <tr class="u-pre u-monospace FileContents-line">
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400272 <td class="u-lineNum u-noSelect FileContents-lineNum"
273 data-line-number="{$n}" onclick="window.location.hash='#{$n}'"></td>
Sagie Maoza6ced582016-03-16 11:31:06 +0200274 <td class="FileContents-lineContents" id="{$n}">
Luke Sandberg9645f0f2017-12-22 11:08:35 -0800275 {for $span in $line}
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400276 <span class="{$span.classes}">{$span.text}</span>
Luke Sandberg9645f0f2017-12-22 11:08:35 -0800277 {/for}
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400278 </td>
279 </tr>
Luke Sandberg9645f0f2017-12-22 11:08:35 -0800280 {/for}
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400281 </table>
Dave Borowitz9de65952012-08-13 16:09:45 -0700282 {else}
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400283 <div class="FileContents-empty">Empty file</div>
Dave Borowitz9de65952012-08-13 16:09:45 -0700284 {/if}
285 {else}
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400286 <div class="FileContents-binary">
Dave Borowitz6ec0c872014-01-29 13:59:37 -0800287 {msg desc="size of binary file in bytes"}{$size}-byte binary file{/msg}
288 </div>
Dave Borowitz9de65952012-08-13 16:09:45 -0700289 {/if}
Dave Borowitz9de65952012-08-13 16:09:45 -0700290{/template}
291
292/**
293 * Detailed listing of an annotated tag.
Dave Borowitz9de65952012-08-13 16:09:45 -0700294 */
Jesse Costello-Good6f62c5d2021-02-02 12:05:06 -0800295{template tagDetail}
Jakub Vranaf525cef2019-03-04 11:21:52 +0100296 {@param sha: ?} /** SHA of this tag. */
297 {@param? tagger: ?} /** optional map with "name", "email", and "time" keys for the tagger. */
298 {@param object: ?} /** SHA of the object this tag points to. */
299 {@param message: ?} /** tag message. */
Andrew Bonventre0ffb2822015-09-16 15:28:02 -0400300<div class="u-monospace Metadata">
Dave Borowitz9de65952012-08-13 16:09:45 -0700301 <table>
302 <tr>
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400303 <th class="Metadata-title">{msg desc="Header for tag SHA entry"}tag{/msg}</th>
Dave Borowitz9de65952012-08-13 16:09:45 -0700304 <td class="sha">{$sha}</td>
305 <td>{sp}</td>
306 </tr>
307 {if $tagger}
308 <tr>
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400309 <th class="Metadata-title">{msg desc="Header for tagger"}tagger{/msg}</th>
Jesse Costello-Good6f62c5d2021-02-02 12:05:06 -0800310 <td>
311 {call person_ data="$tagger" /}
312 </td>
Dave Borowitz9de65952012-08-13 16:09:45 -0700313 <td>{$tagger.time}</td>
314 </tr>
315 {/if}
316 <tr>
Andrew Bonventreb33426e2015-09-09 18:28:28 -0400317 <th class="Metadata-title">{msg desc="Header for tagged object SHA"}object{/msg}</th>
Dave Borowitz9de65952012-08-13 16:09:45 -0700318 <td class="sha">{$object}</td>
319 <td>{sp}</td>
320 </tr>
321 </table>
322</div>
323{if $message and length($message)}
Jesse Costello-Good6f62c5d2021-02-02 12:05:06 -0800324 {call message_}
Andrew Bonventre0ffb2822015-09-16 15:28:02 -0400325 {param className: 'u-pre u-monospace MetadataMessage' /}
Dave Borowitz9de65952012-08-13 16:09:45 -0700326 {param message: $message /}
327 {/call}
328{/if}
329{/template}
330
331/**
332 * Line about a git person identity.
Dave Borowitz9de65952012-08-13 16:09:45 -0700333 */
Jesse Costello-Good6f62c5d2021-02-02 12:05:06 -0800334{template person_}
Jakub Vranaf525cef2019-03-04 11:21:52 +0100335 {@param name: ?} /** name. */
336 {@param email: ?} /** email. */
Dave Borowitz9de65952012-08-13 16:09:45 -0700337{$name}{if $email} &lt;{$email}&gt;{/if}
338{/template}
339
340/**
341 * Preformatted message, possibly containing hyperlinks.
Dave Borowitz9de65952012-08-13 16:09:45 -0700342 */
Jesse Costello-Good6f62c5d2021-02-02 12:05:06 -0800343{template message_ visibility="private"}
Jakub Vranaf525cef2019-03-04 11:21:52 +0100344 {@param className: ?} /** CSS class name for <pre> block. */
Jakub Vranad5e46bc2019-12-05 13:31:54 +0100345 {@param message: ?} /** list of message parts, where each part contains:
346 text: raw text of the part.
347 url: optional URL that should be linked to from the part.
348 */
Dave Borowitze16e4862014-06-26 12:23:18 -0700349<pre class="{$className}">
Luke Sandberg9645f0f2017-12-22 11:08:35 -0800350 {for $part in $message}
Dave Borowitz9de65952012-08-13 16:09:45 -0700351 {if $part.url}<a href="{$part.url}">{$part.text}</a>{else}{$part.text}{/if}
Luke Sandberg9645f0f2017-12-22 11:08:35 -0800352 {/for}
Dave Borowitz9de65952012-08-13 16:09:45 -0700353</pre>
354{/template}