aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java
diff options
context:
space:
mode:
authorTomasz Zarna <Tomasz.Zarna@pl.ibm.com>2012-01-02 08:40:02 -0800
committerKevin Sawicki <kevin@github.com>2012-01-02 08:40:02 -0800
commit1a2ca5b811916013f79fdf2adb08502b872f315c (patch)
treef616e6c2797e94c3660705b2270931726a3cdcb5 /org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java
parent5d95cd9418a20ff72930d4549429d778181eb9ed (diff)
downloadjgit-1a2ca5b811916013f79fdf2adb08502b872f315c.tar.gz
jgit-1a2ca5b811916013f79fdf2adb08502b872f315c.zip
Skip a number commits before starting to show the commit output
Change-Id: Id2666d897d29b6371f7a6cf241cfda02964b4971 Signed-off-by: Kevin Sawicki <kevin@github.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java26
1 files changed, 24 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java
index 632b5d0e30..21a0d342a9 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java
@@ -59,7 +59,9 @@ import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
+import org.eclipse.jgit.revwalk.filter.AndRevFilter;
import org.eclipse.jgit.revwalk.filter.MaxCountRevFilter;
+import org.eclipse.jgit.revwalk.filter.SkipRevFilter;
import org.eclipse.jgit.treewalk.filter.AndTreeFilter;
import org.eclipse.jgit.treewalk.filter.PathFilter;
import org.eclipse.jgit.treewalk.filter.PathFilterGroup;
@@ -88,6 +90,8 @@ public class LogCommand extends GitCommand<Iterable<RevCommit>> {
private int maxCount = -1;
+ private int skip = -1;
+
/**
* @param repo
*/
@@ -111,7 +115,12 @@ public class LogCommand extends GitCommand<Iterable<RevCommit>> {
if (pathFilters.size() > 0)
walk.setTreeFilter(AndTreeFilter.create(
PathFilterGroup.create(pathFilters), TreeFilter.ANY_DIFF));
- if (maxCount > -1)
+ if (skip > -1 && maxCount > -1)
+ walk.setRevFilter(AndRevFilter.create(SkipRevFilter.create(skip),
+ MaxCountRevFilter.create(maxCount)));
+ else if (skip > -1)
+ walk.setRevFilter(SkipRevFilter.create(skip));
+ else if (maxCount > -1)
walk.setRevFilter(MaxCountRevFilter.create(maxCount));
if (!startSpecified) {
try {
@@ -253,7 +262,20 @@ public class LogCommand extends GitCommand<Iterable<RevCommit>> {
}
/**
- * Limit the number of commits to output
+ * Skip the number of commits before starting to show the commit output.
+ *
+ * @param skip
+ * the number of commits to skip
+ * @return {@code this}
+ */
+ public LogCommand setSkip(int skip) {
+ checkCallable();
+ this.skip = skip;
+ return this;
+ }
+
+ /**
+ * Limit the number of commits to output.
*
* @param maxCount
* the limit