mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-11 16:05:49 +01:00
Merge tags and releases
This commit is contained in:
@@ -628,7 +628,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
* Displays tags.
|
* Displays tags.
|
||||||
*/
|
*/
|
||||||
get("/:owner/:repository/tags")(referrersOnly { repository =>
|
get("/:owner/:repository/tags")(referrersOnly { repository =>
|
||||||
html.tags(repository, hasDeveloperRole(repository.owner, repository.name, context.loginAccount))
|
redirect(s"${repository.owner}/${repository.name}/releases")
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -229,10 +229,6 @@ trait RepositoryService { self: AccountService =>
|
|||||||
t.byRepository(repository.userName, repository.repositoryName) && (t.closed === false.bind)
|
t.byRepository(repository.userName, repository.repositoryName) && (t.closed === false.bind)
|
||||||
}.map(_.pullRequest).list
|
}.map(_.pullRequest).list
|
||||||
|
|
||||||
val releases = Releases.filter { t =>
|
|
||||||
t.byRepository(repository.userName, repository.repositoryName)
|
|
||||||
}.list
|
|
||||||
|
|
||||||
new RepositoryInfo(
|
new RepositoryInfo(
|
||||||
JGitUtil.getRepositoryInfo(repository.userName, repository.repositoryName),
|
JGitUtil.getRepositoryInfo(repository.userName, repository.repositoryName),
|
||||||
repository,
|
repository,
|
||||||
@@ -242,7 +238,6 @@ trait RepositoryService { self: AccountService =>
|
|||||||
repository.originUserName.getOrElse(repository.userName),
|
repository.originUserName.getOrElse(repository.userName),
|
||||||
repository.originRepositoryName.getOrElse(repository.repositoryName)
|
repository.originRepositoryName.getOrElse(repository.repositoryName)
|
||||||
),
|
),
|
||||||
releases.length,
|
|
||||||
getRepositoryManagers(repository.userName))
|
getRepositoryManagers(repository.userName))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -515,20 +510,20 @@ trait RepositoryService { self: AccountService =>
|
|||||||
object RepositoryService {
|
object RepositoryService {
|
||||||
|
|
||||||
case class RepositoryInfo(owner: String, name: String, repository: Repository,
|
case class RepositoryInfo(owner: String, name: String, repository: Repository,
|
||||||
issueCount: Int, pullCount: Int, forkedCount: Int, releaseCount: Int,
|
issueCount: Int, pullCount: Int, forkedCount: Int,
|
||||||
branchList: Seq[String], tags: Seq[JGitUtil.TagInfo], managers: Seq[String]) {
|
branchList: Seq[String], tags: Seq[JGitUtil.TagInfo], managers: Seq[String]) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates instance with issue count and pull request count.
|
* Creates instance with issue count and pull request count.
|
||||||
*/
|
*/
|
||||||
def this(repo: JGitUtil.RepositoryInfo, model: Repository, issueCount: Int, pullCount: Int, forkedCount: Int, releaseCount: Int, managers: Seq[String]) =
|
def this(repo: JGitUtil.RepositoryInfo, model: Repository, issueCount: Int, pullCount: Int, forkedCount: Int, managers: Seq[String]) =
|
||||||
this(repo.owner, repo.name, model, issueCount, pullCount, forkedCount, releaseCount, repo.branchList, repo.tags, managers)
|
this(repo.owner, repo.name, model, issueCount, pullCount, forkedCount, repo.branchList, repo.tags, managers)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates instance without issue, pull request and release count.
|
* Creates instance without issue and pull request count.
|
||||||
*/
|
*/
|
||||||
def this(repo: JGitUtil.RepositoryInfo, model: Repository, forkedCount: Int, managers: Seq[String]) =
|
def this(repo: JGitUtil.RepositoryInfo, model: Repository, forkedCount: Int, managers: Seq[String]) =
|
||||||
this(repo.owner, repo.name, model, 0, 0, forkedCount, 0, repo.branchList, repo.tags, managers)
|
this(repo.owner, repo.name, model, 0, 0, forkedCount, repo.branchList, repo.tags, managers)
|
||||||
|
|
||||||
def httpUrl(implicit context: Context): String = RepositoryService.httpUrl(owner, name)
|
def httpUrl(implicit context: Context): String = RepositoryService.httpUrl(owner, name)
|
||||||
def sshUrl(implicit context: Context): Option[String] = RepositoryService.sshUrl(owner, name)
|
def sshUrl(implicit context: Context): Option[String] = RepositoryService.sshUrl(owner, name)
|
||||||
@@ -542,9 +537,10 @@ object RepositoryService {
|
|||||||
|
|
||||||
(id, path.substring(id.length).stripPrefix("/"))
|
(id, path.substring(id.length).stripPrefix("/"))
|
||||||
}
|
}
|
||||||
def getReleaseByTag(tag: String)(implicit s: Session): Option[Release] = {
|
|
||||||
Releases filter (_.byTag(owner, name, tag)) firstOption
|
// def getReleaseByTag(tag: String)(implicit s: Session): Option[Release] = {
|
||||||
}
|
// Releases filter (_.byTag(owner, name, tag)) firstOption
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
def httpUrl(owner: String, name: String)(implicit context: Context): String = s"${context.baseUrl}/git/${owner}/${name}.git"
|
def httpUrl(owner: String, name: String)(implicit context: Context): String = s"${context.baseUrl}/git/${owner}/${name}.git"
|
||||||
|
|||||||
@@ -33,9 +33,8 @@
|
|||||||
@menuitem("", "files", "Files", "code")
|
@menuitem("", "files", "Files", "code")
|
||||||
@if(repository.branchList.nonEmpty) {
|
@if(repository.branchList.nonEmpty) {
|
||||||
@menuitem("/branches", "branches", "Branches", "git-branch", repository.branchList.length)
|
@menuitem("/branches", "branches", "Branches", "git-branch", repository.branchList.length)
|
||||||
@menuitem("/tags", "tags", "Tags", "tag", repository.tags.length)
|
|
||||||
}
|
}
|
||||||
@menuitem("/releases", "releases", "Releases", "gift", repository.releaseCount)
|
@menuitem("/releases", "releases", "Releases", "tag", repository.tags.length)
|
||||||
@if(repository.repository.options.issuesOption != "DISABLE") {
|
@if(repository.repository.options.issuesOption != "DISABLE") {
|
||||||
@menuitem("/issues", "issues", "Issues", "issue-opened", repository.issueCount)
|
@menuitem("/issues", "issues", "Issues", "issue-opened", repository.issueCount)
|
||||||
@menuitem("/pulls", "pulls", "Pull requests", "git-pull-request", repository.pullCount)
|
@menuitem("/pulls", "pulls", "Pull requests", "git-pull-request", repository.pullCount)
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
@(repository: gitbucket.core.service.RepositoryService.RepositoryInfo, hasWritePermission: Boolean)(implicit context: gitbucket.core.controller.Context, s: gitbucket.core.model.Profile.profile.blockingApi.Session)
|
|
||||||
@import gitbucket.core.view.helpers
|
|
||||||
@gitbucket.core.html.main(s"${repository.owner}/${repository.name}", Some(repository)) {
|
|
||||||
@gitbucket.core.html.menu("tags", repository){
|
|
||||||
<table class="table table-bordered">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th width="40%">Tag</th>
|
|
||||||
<th width="15%">Date</th>
|
|
||||||
<th width="15%">Commit</th>
|
|
||||||
<th width="15%">Download</th>
|
|
||||||
<th width="15%">Release</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@repository.tags.reverseMap { tag =>
|
|
||||||
<tr>
|
|
||||||
<td><a href="@helpers.url(repository)/tree/@helpers.encodeRefName(tag.name)">@tag.name</a></td>
|
|
||||||
<td>@gitbucket.core.helper.html.datetimeago(tag.time, false)</td>
|
|
||||||
<td class="monospace"><a href="@helpers.url(repository)/commit/@tag.id">@tag.id.substring(0, 10)</a></td>
|
|
||||||
<td>
|
|
||||||
<a href="@helpers.url(repository)/archive/@{helpers.encodeRefName(tag.name)}.zip">ZIP</a>
|
|
||||||
<a href="@helpers.url(repository)/archive/@{helpers.encodeRefName(tag.name)}.tar.gz">TAR.GZ</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
@repository.getReleaseByTag(tag.name).map{ release =>
|
|
||||||
<a href="@helpers.url(repository)/releases/@release.releaseId">Release</a>
|
|
||||||
}.getOrElse{
|
|
||||||
@if(hasWritePermission){
|
|
||||||
<div class="show-title pull-right">
|
|
||||||
<a class="btn btn-success btn-min" href="@helpers.url(repository)/releases/@{helpers.encodeRefName(tag.name)}/create">Create release</a>
|
|
||||||
</div>
|
|
||||||
} else {
|
|
||||||
<br />
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user