mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 00:15:44 +01:00
use blame pre processor api
This commit is contained in:
@@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory;
|
||||
import sonia.scm.cache.Cache;
|
||||
import sonia.scm.cache.CacheManager;
|
||||
import sonia.scm.repository.BlameResult;
|
||||
import sonia.scm.repository.PreProcessorUtil;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.RepositoryCacheKey;
|
||||
import sonia.scm.repository.RepositoryException;
|
||||
@@ -99,14 +100,16 @@ public final class BlameCommandBuilder
|
||||
* @param cacheManager cache manager
|
||||
* @param blameCommand implementation of the {@link BlameCommand}
|
||||
* @param repository repository to query
|
||||
* @param preProcessorUtil
|
||||
*/
|
||||
BlameCommandBuilder(CacheManager cacheManager, BlameCommand blameCommand,
|
||||
Repository repository)
|
||||
Repository repository, PreProcessorUtil preProcessorUtil)
|
||||
{
|
||||
this.cache = cacheManager.getCache(CacheKey.class, BlameResult.class,
|
||||
CACHE_NAME);
|
||||
this.blameCommand = blameCommand;
|
||||
this.repository = repository;
|
||||
this.preProcessorUtil = preProcessorUtil;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
@@ -183,6 +186,11 @@ public final class BlameCommandBuilder
|
||||
}
|
||||
}
|
||||
|
||||
if (!disablePreProcessors && (result != null))
|
||||
{
|
||||
preProcessorUtil.prepareForReturn(repository, result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -205,6 +213,22 @@ public final class BlameCommandBuilder
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the execution of pre processors.
|
||||
*
|
||||
*
|
||||
* @param disablePreProcessors true to disable the pre processors execution
|
||||
*
|
||||
* @return {@code this}
|
||||
*/
|
||||
public BlameCommandBuilder setDisablePreProcessors(
|
||||
boolean disablePreProcessors)
|
||||
{
|
||||
this.disablePreProcessors = disablePreProcessors;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the start revision for the blame.
|
||||
*
|
||||
@@ -321,6 +345,12 @@ public final class BlameCommandBuilder
|
||||
/** disable change */
|
||||
private boolean disableCache;
|
||||
|
||||
/** disable the execution of pre processors */
|
||||
private boolean disablePreProcessors = false;
|
||||
|
||||
/** Field description */
|
||||
private PreProcessorUtil preProcessorUtil;
|
||||
|
||||
/** the repository */
|
||||
private Repository repository;
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@ import java.io.IOException;
|
||||
* is supported by the {@link RepositoryService} with the
|
||||
* {@link RepositoryService#isSupported(Command)} method.<br />
|
||||
* <br />
|
||||
*
|
||||
* <b>Warning:</b> You should always close the connection to the repository
|
||||
*
|
||||
* <b>Warning:</b> You should always close the connection to the repository
|
||||
* after work is finished. For closing the connection to the repository use the
|
||||
* {@link #close()} method.
|
||||
*
|
||||
@@ -147,7 +147,7 @@ public final class RepositoryService implements Closeable
|
||||
}
|
||||
|
||||
return new BlameCommandBuilder(cacheManager, provider.getBlameCommand(),
|
||||
repository);
|
||||
repository, preProcessorUtil);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user