added support for branches to log command

This commit is contained in:
Sebastian Sdorra
2012-07-27 10:54:24 +02:00
parent a86a817eb0
commit 09828e2aa9
2 changed files with 52 additions and 8 deletions

View File

@@ -114,10 +114,10 @@ public final class LogCommandBuilder
* @param preProcessorUtil * @param preProcessorUtil
*/ */
LogCommandBuilder(CacheManager cacheManager, LogCommand logCommand, LogCommandBuilder(CacheManager cacheManager, LogCommand logCommand,
Repository repository, PreProcessorUtil preProcessorUtil) Repository repository, PreProcessorUtil preProcessorUtil)
{ {
this.cache = cacheManager.getCache(CacheKey.class, this.cache = cacheManager.getCache(CacheKey.class,
ChangesetPagingResult.class, CACHE_NAME); ChangesetPagingResult.class, CACHE_NAME);
this.logCommand = logCommand; this.logCommand = logCommand;
this.repository = repository; this.repository = repository;
this.preProcessorUtil = preProcessorUtil; this.preProcessorUtil = preProcessorUtil;
@@ -170,7 +170,7 @@ public final class LogCommandBuilder
* @throws RepositoryException * @throws RepositoryException
*/ */
public Changeset getChangeset(String id) public Changeset getChangeset(String id)
throws IOException, RepositoryException throws IOException, RepositoryException
{ {
Changeset changeset = null; Changeset changeset = null;
@@ -232,7 +232,7 @@ public final class LogCommandBuilder
* @throws RepositoryException * @throws RepositoryException
*/ */
public ChangesetPagingResult getChangesets() public ChangesetPagingResult getChangesets()
throws IOException, RepositoryException throws IOException, RepositoryException
{ {
ChangesetPagingResult cpr = null; ChangesetPagingResult cpr = null;
@@ -281,6 +281,23 @@ public final class LogCommandBuilder
//~--- set methods ---------------------------------------------------------- //~--- set methods ----------------------------------------------------------
/**
* Retrieves only changesets of the given branch.<br />
* <b>Note:</b> This option is ignored if the underlying
* {@link RepositoryService} does not support the {@link Command#BRANCHES}.
*
*
* @param branch brnach to retrieve changesets from
*
* @return retrieves only changesets of the given branch
*/
public LogCommandBuilder setBranch(String branch)
{
request.setBranch(branch);
return this;
}
/** /**
* Disables the cache for changesets. This means that every {@link Changeset} * Disables the cache for changesets. This means that every {@link Changeset}
* is directly retrieved from the {@link Repository}. <b>Note: </b> Disabling * is directly retrieved from the {@link Repository}. <b>Note: </b> Disabling
@@ -460,8 +477,8 @@ public final class LogCommandBuilder
final CacheKey other = (CacheKey) obj; final CacheKey other = (CacheKey) obj;
return Objects.equal(repositoryId, other.repositoryId) return Objects.equal(repositoryId, other.repositoryId)
&& Objects.equal(changesetId, other.changesetId) && Objects.equal(changesetId, other.changesetId)
&& Objects.equal(request, other.request); && Objects.equal(request, other.request);
} }
/** /**

View File

@@ -81,7 +81,7 @@ public final class LogCommandRequest implements Serializable, Resetable
&& Objects.equal(endChangeset, other.endChangeset) && Objects.equal(endChangeset, other.endChangeset)
&& Objects.equal(pagingStart, other.pagingStart) && Objects.equal(pagingStart, other.pagingStart)
&& Objects.equal(pagingLimit, other.pagingLimit) && Objects.equal(pagingLimit, other.pagingLimit)
&& Objects.equal(path, other.path); && Objects.equal(path, other.path) && Objects.equal(branch, other.branch);
} }
/** /**
@@ -94,7 +94,7 @@ public final class LogCommandRequest implements Serializable, Resetable
public int hashCode() public int hashCode()
{ {
return Objects.hashCode(startChangeset, endChangeset, pagingStart, return Objects.hashCode(startChangeset, endChangeset, pagingStart,
pagingLimit, path); pagingLimit, path, branch);
} }
/** /**
@@ -109,6 +109,7 @@ public final class LogCommandRequest implements Serializable, Resetable
pagingStart = 0; pagingStart = 0;
pagingLimit = 20; pagingLimit = 20;
path = null; path = null;
branch = null;
} }
/** /**
@@ -127,12 +128,24 @@ public final class LogCommandRequest implements Serializable, Resetable
.add("pagingStart", pagingStart) .add("pagingStart", pagingStart)
.add("pagingLimit", pagingLimit) .add("pagingLimit", pagingLimit)
.add("path", path) .add("path", path)
.add("branch", branch)
.toString(); .toString();
//J+ //J+
} }
//~--- set methods ---------------------------------------------------------- //~--- set methods ----------------------------------------------------------
/**
* Method description
*
*
* @param branch
*/
public void setBranch(String branch)
{
this.branch = branch;
}
/** /**
* Method description * Method description
* *
@@ -190,6 +203,17 @@ public final class LogCommandRequest implements Serializable, Resetable
//~--- get methods ---------------------------------------------------------- //~--- get methods ----------------------------------------------------------
/**
* Method description
*
*
* @return
*/
String getBranch()
{
return branch;
}
/** /**
* Method description * Method description
* *
@@ -258,6 +282,9 @@ public final class LogCommandRequest implements Serializable, Resetable
//~--- fields --------------------------------------------------------------- //~--- fields ---------------------------------------------------------------
/** Field description */
private String branch;
/** Field description */ /** Field description */
private String endChangeset; private String endChangeset;