Package sonia.scm.repository.api
Class LogCommandBuilder
java.lang.Object
sonia.scm.repository.api.LogCommandBuilder
LogCommandBuilder is able to show the history of a file in a
Samples:
Retrieve a single
Repository
or the entire history of a Repository
.
This class could be used to retrieve a single Changeset
by its id
or to get a list of changesets in a ChangesetPagingResult
which can be used for paging.Samples:
Retrieve a single
Changeset
:
LogCommandBuilder log = repositoryService.getLogCommand();
Changeset changeset = log.getChangeset("id-of-the-commit");
Retrieve changesets of a Repository
with paging:
LogCommandBuilder log = repositoryService.getLogCommand();
ChangesetPagingResult changesetPagingResult =
log.setPagingStart(25).setPagingLimit(25).getChangesets();
Retrieve all changesets of a file in a Repository
:
LogCommandBuilder log = repositoryService.getLogCommand();
ChangesetPagingResult changesetPagingResult =
log.setPath("pom.xml").disablePagingLimit().getChangesets();
- Since:
- 1.17
-
Method Summary
Modifier and TypeMethodDescriptionDisable paging limit all available changesets will be retrieved.getChangeset
(String id) Returns theChangeset
with the given id or null if theChangeset
could not be found in theRepository
.Return all changesets with the given parameters.reset()
Reset each parameter to its default value.setAncestorChangeset
(String ancestorChangeset) Compute the incoming changes of the branch set withsetBranch(String)
in respect to the changeset given here.Retrieves only changesets of the given branch.
Note: This option is ignored if the underlyingRepositoryService
does not support theCommand.BRANCHES
.setDisableCache
(boolean disableCache) Disables the cache for changesets.setDisablePreProcessors
(boolean disablePreProcessors) Disable the execution of pre processors if set totrue
.setEndChangeset
(String endChangeset) Retrieve changesets until the given theChangeset
with the given id.setPagingLimit
(int pagingLimit) Set the limit for the returned changesets.setPagingStart
(int pagingStart) Sets the start value for paging.Retrieve only changesets which are affect the given path.setStartChangeset
(String startChangeset) Start at the givenChangeset
.
-
Method Details
-
disablePagingLimit
Disable paging limit all available changesets will be retrieved. This method does the same assetPagingLimit(int)
with a value of -1.- Returns:
this
-
reset
Reset each parameter to its default value.- Returns:
this
-
getChangeset
Returns theChangeset
with the given id or null if theChangeset
could not be found in theRepository
.- Parameters:
id
- id of theChangeset
- Returns:
- the
Changeset
with the given id or null - Throws:
IOException
-
getChangesets
Return all changesets with the given parameters.- Returns:
- all changesets with the given parameters
- Throws:
IOException
-
setBranch
Retrieves only changesets of the given branch.
Note: This option is ignored if the underlyingRepositoryService
does not support theCommand.BRANCHES
.- Parameters:
branch
- brnach to retrieve changesets from- Returns:
- retrieves only changesets of the given branch
-
setDisableCache
Disables the cache for changesets. This means that everyChangeset
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 if set totrue
. -
setEndChangeset
Retrieve changesets until the given theChangeset
with the given id.- Parameters:
endChangeset
- id of the endChangeset
- Returns:
this
-
setPagingLimit
Set the limit for the returned changesets. The default value is 20. Setting the value to -1 means to disable the limit.- Parameters:
pagingLimit
- limit for returned changesets- Returns:
this
-
setPagingStart
Sets the start value for paging. The value is 0.- Parameters:
pagingStart
- start value for paging- Returns:
this
-
setPath
Retrieve only changesets which are affect the given path.- Parameters:
path
- file path in theRepository
.- Returns:
this
-
setStartChangeset
Start at the givenChangeset
.- Parameters:
startChangeset
- changeset id to start with- Returns:
this
-
setAncestorChangeset
Compute the incoming changes of the branch set withsetBranch(String)
in respect to the changeset given here. In other words: What changesets would be new to the ancestor changeset given here when the branch would be merged into it. Requires featureFeature.INCOMING_REVISION
!- Returns:
this
-