| |
---|
| | * @return the repository information |
---|
| | */ |
---|
| | def getRepository(userName: String, repositoryName: String, baseUrl: String): Option[RepositoryInfo] = { |
---|
| | (Query(Repositories) filter { t => t.byRepository(userName, repositoryName) } firstOption) map { repository => |
---|
| | // for getting issue count and pull request count |
---|
| | val issues = Query(Issues).filter { t => |
---|
| | t.byRepository(repository.userName, repository.repositoryName) && (t.closed is false.bind) |
---|
| | }.map(_.pullRequest).list |
---|
| | |
---|
| | new RepositoryInfo( |
---|
| | JGitUtil.getRepositoryInfo(repository.userName, repository.repositoryName, baseUrl), |
---|
| | repository, |
---|
| | issues.size, |
---|
| | issues.filter(_ == true).size, |
---|
| | getForkedCount( |
---|
| | repository.originUserName.getOrElse(repository.userName), |
---|
| | repository.originRepositoryName.getOrElse(repository.repositoryName) |
---|
| | )) |
---|
| |
---|
| | |
---|
| | object RepositoryService { |
---|
| | |
---|
| | case class RepositoryInfo(owner: String, name: String, url: String, repository: Repository, |
---|
| | commitCount: Int, forkedCount: Int, branchList: List[String], tags: List[util.JGitUtil.TagInfo]){ |
---|
| | |
---|
| | def this(repo: JGitUtil.RepositoryInfo, model: Repository, forkedCount: Int) = { |
---|
| | this(repo.owner, repo.name, repo.url, model, repo.commitCount, forkedCount, repo.branchList, repo.tags) |
---|
| | } |
---|
| | issueCount: Int, pullCount: Int, commitCount: Int, forkedCount: Int, |
---|
| | branchList: List[String], tags: List[util.JGitUtil.TagInfo]){ |
---|
| | |
---|
| | /** |
---|
| | * Creates instance with issue count and pull request count. |
---|
| | */ |
---|
| | def this(repo: JGitUtil.RepositoryInfo, model: Repository, issueCount: Int, pullCount: Int, forkedCount: Int) = |
---|
| | this(repo.owner, repo.name, repo.url, model, issueCount, pullCount, repo.commitCount, forkedCount, repo.branchList, repo.tags) |
---|
| | |
---|
| | /** |
---|
| | * Creates instance without issue count and pull request count. |
---|
| | */ |
---|
| | def this(repo: JGitUtil.RepositoryInfo, model: Repository, forkedCount: Int) = |
---|
| | this(repo.owner, repo.name, repo.url, model, 0, 0, repo.commitCount, forkedCount, repo.branchList, repo.tags) |
---|
| | } |
---|
| | |
---|
| | case class RepositoryTreeNode(owner: String, name: String, children: List[RepositoryTreeNode]) |
---|
| | |
---|
| | |
|