Display parent commit id at the commit details page.

This commit is contained in:
takezoe
2013-06-19 20:07:51 +09:00
parent 3f945b7328
commit cd14d22737
2 changed files with 20 additions and 3 deletions

View File

@@ -52,10 +52,13 @@ object JGitUtil {
* @param committer the commiter name * @param committer the commiter name
* @param shortMessage the short message * @param shortMessage the short message
* @param fullMessage the full message * @param fullMessage the full message
* @param parents the list of parent commid id
*/ */
case class CommitInfo(id: String, time: Date, committer: String, shortMessage: String, fullMessage: String){ case class CommitInfo(id: String, time: Date, committer: String, shortMessage: String, fullMessage: String, parents: List[String]){
def this(rev: org.eclipse.jgit.revwalk.RevCommit) =
this(rev.getName, rev.getCommitterIdent.getWhen, rev.getCommitterIdent.getName, rev.getShortMessage, rev.getFullMessage) def this(rev: org.eclipse.jgit.revwalk.RevCommit) = this(
rev.getName, rev.getCommitterIdent.getWhen, rev.getCommitterIdent.getName, rev.getShortMessage, rev.getFullMessage,
rev.getParents().map(_.name).toList)
val description = { val description = {
val i = fullMessage.trim.indexOf("\n") val i = fullMessage.trim.indexOf("\n")

View File

@@ -22,7 +22,21 @@
<td> <td>
<a href="@path/@commit.committer" class="username">@commit.committer</a> <span class="description">@helpers.datetime(commit.time)</span> <a href="@path/@commit.committer" class="username">@commit.committer</a> <span class="description">@helpers.datetime(commit.time)</span>
<div class="pull-right align-right monospace small"> <div class="pull-right align-right monospace small">
@if(commit.parents.size == 0){
<span class="description">0 parent</span>
}
@if(commit.parents.size == 1){
<span class="description">1 parent</span>
<a href="@path/@repository.owner/@repository.name/commit/@commit.parents(0)" class="commit-id">@commit.parents(0).substring(0, 7)</a>
}
<span class="description">commit</span> @commit.id <span class="description">commit</span> @commit.id
@if(commit.parents.size > 1){
<br>
<span class="description">@commit.parents.size parent</span>
@commit.parents.map { parent =>
@parent
}.mkString(" + ")
}
</div> </div>
</td> </td>
</tr> </tr>