public class LogCommand extends GitCommand<Iterable<RevCommit>>
Log command. It has setters for all
 supported options and arguments of this command and a call() method
 to finally execute the command. Each instance of this class should only be
 used for one invocation of the command (means: one call to call())
 
 Examples (git is a Git instance):
 
Get newest 10 commits, starting from the current branch:
ObjectId head = repository.resolve(Constants.HEAD); Iterable<RevCommit> commits = git.log().add(head).setMaxCount(10).call();
Get commits only for a specific file:
 git.log().add(head).addPath("dir/filename.txt").call();
 
 repo| Modifier | Constructor and Description | 
|---|---|
protected  | 
LogCommand(Repository repo)
Constructor for LogCommand. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
LogCommand | 
add(AnyObjectId start)
Mark a commit to start graph traversal from. 
 | 
LogCommand | 
addPath(String path)
Show only commits that affect any of the specified paths. 
 | 
LogCommand | 
addRange(AnyObjectId since,
        AnyObjectId until)
Adds the range  
since..until | 
LogCommand | 
all()
Add all refs as commits to start the graph traversal from. 
 | 
Iterable<RevCommit> | 
call() | 
LogCommand | 
not(AnyObjectId start)
Same as  
--not start, or ^start | 
LogCommand | 
setMaxCount(int maxCount)
Limit the number of commits to output. 
 | 
LogCommand | 
setRevFilter(RevFilter aFilter)
Set a filter for the  
LogCommand. | 
LogCommand | 
setSkip(int skip)
Skip the number of commits before starting to show the commit output. 
 | 
checkCallable, getRepository, setCallableprotected LogCommand(Repository repo)
repo - the Repositorypublic Iterable<RevCommit> call() throws GitAPIException, NoHeadException
Execute the command
 Executes the Log command with all the options and parameters
 collected by the setter methods (e.g. add(AnyObjectId),
 not(AnyObjectId), ..) of this class. Each instance of this class
 should only be used for one invocation of the command. Don't call this
 method twice on an instance.
call in interface Callable<Iterable<RevCommit>>call in class GitCommand<Iterable<RevCommit>>GitAPIExceptionNoHeadExceptionpublic LogCommand add(AnyObjectId start) throws MissingObjectException, IncorrectObjectTypeException
start - the id of the commit to start fromthisMissingObjectException - the commit supplied is not available from the object
             database. This usually indicates the supplied commit is
             invalid, but the reference was constructed during an earlier
             invocation to
             RevWalk.lookupCommit(AnyObjectId).IncorrectObjectTypeException - the object was not parsed yet and it was discovered during
             parsing that it is not actually a commit. This usually
             indicates the caller supplied a non-commit SHA-1 to
             RevWalk.lookupCommit(AnyObjectId).JGitInternalException - a low-level exception of JGit has occurred. The original
             exception can be retrieved by calling
             Throwable.getCause(). Expect only
             IOException's to be wrapped. Subclasses of
             IOException (e.g.
             MissingObjectException) are
             typically not wrapped here but thrown as original exceptionRevWalk.markStart(RevCommit)public LogCommand not(AnyObjectId start) throws MissingObjectException, IncorrectObjectTypeException
--not start, or ^startstart - a AnyObjectIdthisMissingObjectException - the commit supplied is not available from the object
             database. This usually indicates the supplied commit is
             invalid, but the reference was constructed during an earlier
             invocation to
             RevWalk.lookupCommit(AnyObjectId).IncorrectObjectTypeException - the object was not parsed yet and it was discovered during
             parsing that it is not actually a commit. This usually
             indicates the caller supplied a non-commit SHA-1 to
             RevWalk.lookupCommit(AnyObjectId).JGitInternalException - a low-level exception of JGit has occurred. The original
             exception can be retrieved by calling
             Throwable.getCause(). Expect only
             IOException's to be wrapped. Subclasses of
             IOException (e.g.
             MissingObjectException) are
             typically not wrapped here but thrown as original exceptionpublic LogCommand addRange(AnyObjectId since, AnyObjectId until) throws MissingObjectException, IncorrectObjectTypeException
since..untilsince - a AnyObjectId object.until - a AnyObjectId object.thisMissingObjectException - the commit supplied is not available from the object
             database. This usually indicates the supplied commit is
             invalid, but the reference was constructed during an earlier
             invocation to
             RevWalk.lookupCommit(AnyObjectId).IncorrectObjectTypeException - the object was not parsed yet and it was discovered during
             parsing that it is not actually a commit. This usually
             indicates the caller supplied a non-commit SHA-1 to
             RevWalk.lookupCommit(AnyObjectId).JGitInternalException - a low-level exception of JGit has occurred. The original
             exception can be retrieved by calling
             Throwable.getCause(). Expect only
             IOException's to be wrapped. Subclasses of
             IOException (e.g.
             MissingObjectException) are
             typically not wrapped here but thrown as original exceptionpublic LogCommand all() throws IOException
thisIOException - the references could not be accessedadd(AnyObjectId)public LogCommand addPath(String path)
/ (slash)
 as separator. Note that regex expressions or wildcards are not supported.path - a repository-relative path (with / as separator)thispublic LogCommand setSkip(int skip)
skip - the number of commits to skipthispublic LogCommand setMaxCount(int maxCount)
maxCount - the limitthispublic LogCommand setRevFilter(RevFilter aFilter)
LogCommand.aFilter - the filter that this instance of LogCommand
            should usethisCopyright © 2018 Eclipse JGit Project. All rights reserved.