Cleanup import statements and add Scaladoc.

This commit is contained in:
takezoe
2013-04-22 09:18:14 +09:00
parent 973e0bbfd8
commit a2cdeb2ad2

View File

@@ -7,14 +7,12 @@ import java.io.File
import java.util.Date import java.util.Date
import org.eclipse.jgit.api.Git import org.eclipse.jgit.api.Git
import org.eclipse.jgit.lib._ import org.eclipse.jgit.lib._
import org.eclipse.jgit.revwalk._
import org.apache.commons.io.FileUtils import org.apache.commons.io.FileUtils
import org.eclipse.jgit.revwalk.RevWalk import org.eclipse.jgit.revwalk.RevWalk
import org.eclipse.jgit.treewalk.CanonicalTreeParser import org.eclipse.jgit.treewalk.CanonicalTreeParser
import org.eclipse.jgit.diff.DiffEntry.ChangeType import org.eclipse.jgit.diff.DiffEntry.ChangeType
import org.eclipse.jgit.errors.MissingObjectException import org.eclipse.jgit.errors.MissingObjectException
import org.eclipse.jgit.treewalk.TreeWalk import org.eclipse.jgit.treewalk.TreeWalk
import org.eclipse.jgit.diff.DiffEntry
case class RepositoryInfo(owner: String, name: String, url: String, branchList: List[String], tags: List[String]) case class RepositoryInfo(owner: String, name: String, url: String, branchList: List[String], tags: List[String])
@@ -167,6 +165,13 @@ class RepositoryViewerServlet extends ServletBase {
repositoryInfo, diffs) repositoryInfo, diffs)
} }
/**
* Get object content of the given id as String from the Git repository.
*
* @param git the Git object
* @param id the object id
* @return the object or None if object does not exist
*/
def getContent(git: Git, id: ObjectId): Option[String] = try { def getContent(git: Git, id: ObjectId): Option[String] = try {
Some(new String(git.getRepository.getObjectDatabase.open(id).getBytes, "UTF-8")) Some(new String(git.getRepository.getObjectDatabase.open(id).getBytes, "UTF-8"))
} catch { } catch {