Package com.google.gerrit.server.change
Class FileContentUtil
java.lang.Object
com.google.gerrit.server.change.FileContentUtil
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondownloadContent(ProjectState project, org.eclipse.jgit.lib.ObjectId revstr, String path, Integer parent) getContent(ProjectState project, org.eclipse.jgit.lib.ObjectId revstr, String path, Integer parent) Get the content of a file at a specific commit or one of it's parent commits.getContent(org.eclipse.jgit.lib.Repository repo, ProjectState project, org.eclipse.jgit.lib.ObjectId revstr, String path) static StringresolveContentType(ProjectState project, String path, PatchScript.FileMode fileMode, String mimeType)
-
Field Details
-
TEXT_X_GERRIT_COMMIT_MESSAGE
- See Also:
-
TEXT_X_GERRIT_MERGE_LIST
- See Also:
-
-
Method Details
-
getContent
public BinaryResult getContent(ProjectState project, org.eclipse.jgit.lib.ObjectId revstr, String path, Integer parent) throws BadRequestException, ResourceNotFoundException, IOException Get the content of a file at a specific commit or one of it's parent commits.- Parameters:
project- AProjectthat this request refers to.revstr- AnObjectIdspecifying the commit.path- A string specifying the filepath.parent- A 1-based parent index to get the content from instead. Null if the content should be obtained fromrevstrinstead.- Returns:
- Content of the file as
BinaryResult. - Throws:
BadRequestExceptionResourceNotFoundExceptionIOException
-
getContent
public BinaryResult getContent(org.eclipse.jgit.lib.Repository repo, ProjectState project, org.eclipse.jgit.lib.ObjectId revstr, String path) throws IOException, ResourceNotFoundException, BadRequestException -
downloadContent
public BinaryResult downloadContent(ProjectState project, org.eclipse.jgit.lib.ObjectId revstr, String path, Integer parent) throws ResourceNotFoundException, IOException, BadRequestException -
resolveContentType
public static String resolveContentType(ProjectState project, String path, PatchScript.FileMode fileMode, String mimeType)
-