|
|
@ -44,6 +44,8 @@ package org.eclipse.jgit.api; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
import java.text.MessageFormat; |
|
|
|
import java.text.MessageFormat; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import org.eclipse.jgit.JGitText; |
|
|
|
import org.eclipse.jgit.JGitText; |
|
|
|
import org.eclipse.jgit.api.errors.JGitInternalException; |
|
|
|
import org.eclipse.jgit.api.errors.JGitInternalException; |
|
|
@ -56,6 +58,8 @@ import org.eclipse.jgit.lib.ObjectId; |
|
|
|
import org.eclipse.jgit.lib.Repository; |
|
|
|
import org.eclipse.jgit.lib.Repository; |
|
|
|
import org.eclipse.jgit.revwalk.RevCommit; |
|
|
|
import org.eclipse.jgit.revwalk.RevCommit; |
|
|
|
import org.eclipse.jgit.revwalk.RevWalk; |
|
|
|
import org.eclipse.jgit.revwalk.RevWalk; |
|
|
|
|
|
|
|
import org.eclipse.jgit.treewalk.filter.PathFilter; |
|
|
|
|
|
|
|
import org.eclipse.jgit.treewalk.filter.PathFilterGroup; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* A class used to execute a {@code Log} command. It has setters for all |
|
|
|
* A class used to execute a {@code Log} command. It has setters for all |
|
|
@ -76,6 +80,8 @@ public class LogCommand extends GitCommand<Iterable<RevCommit>> { |
|
|
|
|
|
|
|
|
|
|
|
private boolean startSpecified = false; |
|
|
|
private boolean startSpecified = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final List<PathFilter> pathFilters = new ArrayList<PathFilter>(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @param repo |
|
|
|
* @param repo |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -96,6 +102,8 @@ public class LogCommand extends GitCommand<Iterable<RevCommit>> { |
|
|
|
public Iterable<RevCommit> call() throws NoHeadException, |
|
|
|
public Iterable<RevCommit> call() throws NoHeadException, |
|
|
|
JGitInternalException { |
|
|
|
JGitInternalException { |
|
|
|
checkCallable(); |
|
|
|
checkCallable(); |
|
|
|
|
|
|
|
if (pathFilters.size() > 0) |
|
|
|
|
|
|
|
walk.setTreeFilter(PathFilterGroup.create(pathFilters)); |
|
|
|
if (!startSpecified) { |
|
|
|
if (!startSpecified) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
ObjectId headId = repo.resolve(Constants.HEAD); |
|
|
|
ObjectId headId = repo.resolve(Constants.HEAD); |
|
|
@ -202,6 +210,21 @@ public class LogCommand extends GitCommand<Iterable<RevCommit>> { |
|
|
|
return not(since).add(until); |
|
|
|
return not(since).add(until); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Show only commits that affect any of the specified paths. The path must |
|
|
|
|
|
|
|
* either name a file or a directory exactly. Note that regex expressions or |
|
|
|
|
|
|
|
* wildcards are not supported. |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param path |
|
|
|
|
|
|
|
* a path is relative to the top level of the repository |
|
|
|
|
|
|
|
* @return {@code this} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public LogCommand addPath(String path) { |
|
|
|
|
|
|
|
checkCallable(); |
|
|
|
|
|
|
|
pathFilters.add(PathFilter.create(path)); |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private LogCommand add(boolean include, AnyObjectId start) |
|
|
|
private LogCommand add(boolean include, AnyObjectId start) |
|
|
|
throws MissingObjectException, IncorrectObjectTypeException, |
|
|
|
throws MissingObjectException, IncorrectObjectTypeException, |
|
|
|
JGitInternalException { |
|
|
|
JGitInternalException { |
|
|
|