(refs #2)Implementing the comparing view.

This commit is contained in:
takezoe
2013-07-13 20:09:19 +09:00
parent 2cc2902930
commit eb82af9006
5 changed files with 104 additions and 14 deletions

View File

@@ -15,6 +15,7 @@ import org.eclipse.jgit.util.io.DisabledOutputStream
import org.eclipse.jgit.errors.MissingObjectException
import java.util.Date
import org.eclipse.jgit.api.errors.NoHeadException
import service.RepositoryService
/**
* Provides complex JGit operations.
@@ -419,7 +420,7 @@ object JGitUtil {
case true if(logs.size < 2) => getCommitLog(i, logs :+ i.next)
case _ => logs
}
val revWalk = new RevWalk(git.getRepository)
revWalk.markStart(revWalk.parseCommit(git.getRepository.resolve(id)))
@@ -532,4 +533,14 @@ object JGitUtil {
config.save
}
def getDefaultBranch(git: Git, repository: RepositoryService.RepositoryInfo,
revstr: String = ""): Option[(ObjectId, String)] = {
Seq(
if(revstr.isEmpty) repository.repository.defaultBranch else revstr,
repository.branchList.head
).map { rev =>
(git.getRepository.resolve(rev), rev)
}.find(_._1 != null)
}
}