diff --git a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java
index a7a3aaad71..c09ab7edcd 100644
--- a/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java
+++ b/scm-core/src/main/java/sonia/scm/repository/api/LogCommandBuilder.java
@@ -114,10 +114,10 @@ public final class LogCommandBuilder
* @param preProcessorUtil
*/
LogCommandBuilder(CacheManager cacheManager, LogCommand logCommand,
- Repository repository, PreProcessorUtil preProcessorUtil)
+ Repository repository, PreProcessorUtil preProcessorUtil)
{
this.cache = cacheManager.getCache(CacheKey.class,
- ChangesetPagingResult.class, CACHE_NAME);
+ ChangesetPagingResult.class, CACHE_NAME);
this.logCommand = logCommand;
this.repository = repository;
this.preProcessorUtil = preProcessorUtil;
@@ -170,7 +170,7 @@ public final class LogCommandBuilder
* @throws RepositoryException
*/
public Changeset getChangeset(String id)
- throws IOException, RepositoryException
+ throws IOException, RepositoryException
{
Changeset changeset = null;
@@ -232,7 +232,7 @@ public final class LogCommandBuilder
* @throws RepositoryException
*/
public ChangesetPagingResult getChangesets()
- throws IOException, RepositoryException
+ throws IOException, RepositoryException
{
ChangesetPagingResult cpr = null;
@@ -281,6 +281,23 @@ public final class LogCommandBuilder
//~--- set methods ----------------------------------------------------------
+ /**
+ * Retrieves only changesets of the given branch.
+ * Note: 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}
* is directly retrieved from the {@link Repository}. Note: Disabling
@@ -460,8 +477,8 @@ public final class LogCommandBuilder
final CacheKey other = (CacheKey) obj;
return Objects.equal(repositoryId, other.repositoryId)
- && Objects.equal(changesetId, other.changesetId)
- && Objects.equal(request, other.request);
+ && Objects.equal(changesetId, other.changesetId)
+ && Objects.equal(request, other.request);
}
/**
diff --git a/scm-core/src/main/java/sonia/scm/repository/spi/LogCommandRequest.java b/scm-core/src/main/java/sonia/scm/repository/spi/LogCommandRequest.java
index 84a45b2b0c..feed50abda 100644
--- a/scm-core/src/main/java/sonia/scm/repository/spi/LogCommandRequest.java
+++ b/scm-core/src/main/java/sonia/scm/repository/spi/LogCommandRequest.java
@@ -81,7 +81,7 @@ public final class LogCommandRequest implements Serializable, Resetable
&& Objects.equal(endChangeset, other.endChangeset)
&& Objects.equal(pagingStart, other.pagingStart)
&& 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()
{
return Objects.hashCode(startChangeset, endChangeset, pagingStart,
- pagingLimit, path);
+ pagingLimit, path, branch);
}
/**
@@ -109,6 +109,7 @@ public final class LogCommandRequest implements Serializable, Resetable
pagingStart = 0;
pagingLimit = 20;
path = null;
+ branch = null;
}
/**
@@ -127,12 +128,24 @@ public final class LogCommandRequest implements Serializable, Resetable
.add("pagingStart", pagingStart)
.add("pagingLimit", pagingLimit)
.add("path", path)
+ .add("branch", branch)
.toString();
//J+
}
//~--- set methods ----------------------------------------------------------
+ /**
+ * Method description
+ *
+ *
+ * @param branch
+ */
+ public void setBranch(String branch)
+ {
+ this.branch = branch;
+ }
+
/**
* Method description
*
@@ -190,6 +203,17 @@ public final class LogCommandRequest implements Serializable, Resetable
//~--- get methods ----------------------------------------------------------
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ String getBranch()
+ {
+ return branch;
+ }
+
/**
* Method description
*
@@ -258,6 +282,9 @@ public final class LogCommandRequest implements Serializable, Resetable
//~--- fields ---------------------------------------------------------------
+ /** Field description */
+ private String branch;
+
/** Field description */
private String endChangeset;