Package sonia.scm.repository.api
Class BlameCommandBuilder
java.lang.Object
sonia.scm.repository.api.BlameCommandBuilder
Shows changeset information by line for a given file.
Blame is also known as annotate in some SCM systems.
Sample:
Print each line number and code of the file scm-core/pom.xml at revision 60c2f2783368:
Sample:
Print each line number and code of the file scm-core/pom.xml at revision 60c2f2783368:
BlameCommandBuilder blame = repositoryService.getBlameCommand();
BlameResult result = blame.setRevision("60c2f2783368")
.getBlameResult("scm-core/pom.xml");
for ( BlameLine line : result ){
System.out.println(line.getLineNumber() + ": " + line.getCode());
}
- Since:
- 1.17
-
Method Summary
Modifier and TypeMethodDescriptiongetBlameResult
(String path) Returns changeset information by line for the given file.reset()
Reset each parameter to its default value.setDisableCache
(boolean disableCache) Disables the cache.setDisablePreProcessors
(boolean disablePreProcessors) Disable the execution of pre-processors.setRevision
(String revision) Sets the start revision for the blame.
-
Method Details
-
reset
Reset each parameter to its default value.- Returns:
this
-
getBlameResult
Returns changeset information by line for the given file.- Parameters:
path
- path of the file- Returns:
- changeset information by line for the given file
- Throws:
IllegalArgumentException
- if the path is null or emptyIOException
-
setDisableCache
Disables the cache. This means that everyBlameResult
is directly retrieved from theRepository
. Note: Disabling the cache cost a lot of performance and could be much more slower.- Parameters:
disableCache
- true to disable the cache- Returns:
this
-
setDisablePreProcessors
Disable the execution of pre-processors.- Parameters:
disablePreProcessors
- true to disable the pre processors execution- Returns:
this
-
setRevision
Sets the start revision for the blame.- Parameters:
revision
- revision to start from- Returns:
this
-