mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 08:25: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.Cache;
|
||||||
import sonia.scm.cache.CacheManager;
|
import sonia.scm.cache.CacheManager;
|
||||||
import sonia.scm.repository.BlameResult;
|
import sonia.scm.repository.BlameResult;
|
||||||
|
import sonia.scm.repository.PreProcessorUtil;
|
||||||
import sonia.scm.repository.Repository;
|
import sonia.scm.repository.Repository;
|
||||||
import sonia.scm.repository.RepositoryCacheKey;
|
import sonia.scm.repository.RepositoryCacheKey;
|
||||||
import sonia.scm.repository.RepositoryException;
|
import sonia.scm.repository.RepositoryException;
|
||||||
@@ -99,14 +100,16 @@ public final class BlameCommandBuilder
|
|||||||
* @param cacheManager cache manager
|
* @param cacheManager cache manager
|
||||||
* @param blameCommand implementation of the {@link BlameCommand}
|
* @param blameCommand implementation of the {@link BlameCommand}
|
||||||
* @param repository repository to query
|
* @param repository repository to query
|
||||||
|
* @param preProcessorUtil
|
||||||
*/
|
*/
|
||||||
BlameCommandBuilder(CacheManager cacheManager, BlameCommand blameCommand,
|
BlameCommandBuilder(CacheManager cacheManager, BlameCommand blameCommand,
|
||||||
Repository repository)
|
Repository repository, PreProcessorUtil preProcessorUtil)
|
||||||
{
|
{
|
||||||
this.cache = cacheManager.getCache(CacheKey.class, BlameResult.class,
|
this.cache = cacheManager.getCache(CacheKey.class, BlameResult.class,
|
||||||
CACHE_NAME);
|
CACHE_NAME);
|
||||||
this.blameCommand = blameCommand;
|
this.blameCommand = blameCommand;
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
|
this.preProcessorUtil = preProcessorUtil;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
@@ -183,6 +186,11 @@ public final class BlameCommandBuilder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!disablePreProcessors && (result != null))
|
||||||
|
{
|
||||||
|
preProcessorUtil.prepareForReturn(repository, result);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,6 +213,22 @@ public final class BlameCommandBuilder
|
|||||||
return this;
|
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.
|
* Sets the start revision for the blame.
|
||||||
*
|
*
|
||||||
@@ -321,6 +345,12 @@ public final class BlameCommandBuilder
|
|||||||
/** disable change */
|
/** disable change */
|
||||||
private boolean disableCache;
|
private boolean disableCache;
|
||||||
|
|
||||||
|
/** disable the execution of pre processors */
|
||||||
|
private boolean disablePreProcessors = false;
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private PreProcessorUtil preProcessorUtil;
|
||||||
|
|
||||||
/** the repository */
|
/** the repository */
|
||||||
private Repository repository;
|
private Repository repository;
|
||||||
|
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ public final class RepositoryService implements Closeable
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new BlameCommandBuilder(cacheManager, provider.getBlameCommand(),
|
return new BlameCommandBuilder(cacheManager, provider.getBlameCommand(),
|
||||||
repository);
|
repository, preProcessorUtil);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user