public class LogCommand extends GitCommand<java.lang.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()
)
This is currently a very basic implementation which takes only one starting revision as option. TODO: add more options (revision ranges, sorting, ...)
repo
Modifier | Constructor and Description |
---|---|
protected |
LogCommand(Repository repo) |
Modifier and Type | Method and Description |
---|---|
LogCommand |
add(AnyObjectId start)
Mark a commit to start graph traversal from.
|
LogCommand |
addPath(java.lang.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.
|
java.lang.Iterable<RevCommit> |
call()
Executes the
Log command with all the options and parameters
collected by the setter methods (e.g. |
LogCommand |
not(AnyObjectId start)
Same as
--not start , or ^start |
LogCommand |
setMaxCount(int maxCount)
Limit the number of commits to output.
|
LogCommand |
setSkip(int skip)
Skip the number of commits before starting to show the commit output.
|
checkCallable, getRepository, setCallable
protected LogCommand(Repository repo)
repo
- public java.lang.Iterable<RevCommit> call() throws NoHeadException, JGitInternalException
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.NoHeadException
JGitInternalException
public LogCommand add(AnyObjectId start) throws MissingObjectException, IncorrectObjectTypeException, JGitInternalException
start
- this
MissingObjectException
- 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, JGitInternalException
--not start
, or ^start
start
- this
MissingObjectException
- 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, JGitInternalException
since..until
since
- until
- this
MissingObjectException
- 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 java.io.IOException
this
java.io.IOException
- the references could not be accessedadd(AnyObjectId)
public LogCommand addPath(java.lang.String path)
path
- a path is relative to the top level of the repositorythis
public LogCommand setSkip(int skip)
skip
- the number of commits to skipthis
public LogCommand setMaxCount(int maxCount)
maxCount
- the limitthis
Copyright © 2012. All Rights Reserved.