Class BlameCommandBuilder

java.lang.Object
sonia.scm.repository.api.BlameCommandBuilder

public final class BlameCommandBuilder extends Object
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:

 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 Details

    • reset

      public BlameCommandBuilder reset()
      Reset each parameter to its default value.
      Returns:
      this
    • getBlameResult

      public BlameResult getBlameResult(String path) throws IOException
      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 empty
      IOException
    • setDisableCache

      public BlameCommandBuilder setDisableCache(boolean disableCache)
      Disables the cache. This means that every BlameResult is directly retrieved from the Repository. 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

      public BlameCommandBuilder setDisablePreProcessors(boolean disablePreProcessors)
      Disable the execution of pre-processors.
      Parameters:
      disablePreProcessors - true to disable the pre processors execution
      Returns:
      this
    • setRevision

      public BlameCommandBuilder setRevision(String revision)
      Sets the start revision for the blame.
      Parameters:
      revision - revision to start from
      Returns:
      this