Package org.eclipse.jgit.api
Class NameRevCommand
- java.lang.Object
-
- org.eclipse.jgit.api.GitCommand<java.util.Map<ObjectId,java.lang.String>>
-
- org.eclipse.jgit.api.NameRevCommand
-
- All Implemented Interfaces:
java.util.concurrent.Callable<java.util.Map<ObjectId,java.lang.String>>
public class NameRevCommand extends GitCommand<java.util.Map<ObjectId,java.lang.String>>
Command to find human-readable names of revisions.- Since:
- 3.0
- See Also:
- Git documentation about name-rev
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classNameRevCommand.NameRevCommit
-
Field Summary
Fields Modifier and Type Field Description private static intCOMMIT_TIME_SLOPAmount of slop to allow walking past the earliest requested commit.private static intMERGE_COSTCost of traversing a merge commit compared to a linear history.private intmergeCostprivate java.util.List<java.lang.String>prefixesprivate java.util.List<Ref>refsprivate java.util.List<ObjectId>revsprivate RevWalkwalk-
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNameRevCommand(Repository repo)Create a new name-rev command.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description NameRevCommandadd(java.lang.Iterable<ObjectId> ids)Add multiple objects to search for.NameRevCommandadd(ObjectId id)Add an object to search for.NameRevCommandaddAnnotatedTags()Add all annotated tags underrefs/tags/to the set that all results must match.NameRevCommandaddPrefix(java.lang.String prefix)Add a ref prefix to the set that results must match.private voidaddPrefix(java.lang.String prefix, java.util.Map<ObjectId,java.lang.String> nonCommits, FIFORevQueue pending)private voidaddPrefixes(java.util.Map<ObjectId,java.lang.String> nonCommits, FIFORevQueue pending)NameRevCommandaddRef(Ref ref)Add a ref to the set that all results must match.private voidaddRef(Ref ref, java.util.Map<ObjectId,java.lang.String> nonCommits, FIFORevQueue pending)java.util.Map<ObjectId,java.lang.String>call()private longcompare(java.lang.String leftTip, long leftCost, java.lang.String rightTip, long rightCost)private intminCommitTime()(package private) NameRevCommandsetMergeCost(int cost)private static java.lang.Stringsimplify(java.lang.String refName)-
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
-
-
-
Field Detail
-
COMMIT_TIME_SLOP
private static final int COMMIT_TIME_SLOP
Amount of slop to allow walking past the earliest requested commit.- See Also:
- Constant Field Values
-
MERGE_COST
private static final int MERGE_COST
Cost of traversing a merge commit compared to a linear history.- See Also:
- Constant Field Values
-
walk
private final RevWalk walk
-
prefixes
private final java.util.List<java.lang.String> prefixes
-
revs
private final java.util.List<ObjectId> revs
-
refs
private java.util.List<Ref> refs
-
mergeCost
private int mergeCost
-
-
Constructor Detail
-
NameRevCommand
protected NameRevCommand(Repository repo)
Create a new name-rev command.- Parameters:
repo- theRepository
-
-
Method Detail
-
call
public java.util.Map<ObjectId,java.lang.String> call() throws GitAPIException
Execute the command
- Specified by:
callin interfacejava.util.concurrent.Callable<java.util.Map<ObjectId,java.lang.String>>- Specified by:
callin classGitCommand<java.util.Map<ObjectId,java.lang.String>>- Throws:
GitAPIException
-
add
public NameRevCommand add(ObjectId id) throws MissingObjectException, JGitInternalException
Add an object to search for.- Parameters:
id- object ID to add.- Returns:
this- Throws:
MissingObjectException- the object supplied is not available from the object database.JGitInternalException- a low-level exception of JGit has occurred. The original exception can be retrieved by callingThrowable.getCause().
-
add
public NameRevCommand add(java.lang.Iterable<ObjectId> ids) throws MissingObjectException, JGitInternalException
Add multiple objects to search for.- Parameters:
ids- object IDs to add.- Returns:
this- Throws:
MissingObjectException- the object supplied is not available from the object database.JGitInternalException- a low-level exception of JGit has occurred. The original exception can be retrieved by callingThrowable.getCause().
-
addPrefix
public NameRevCommand addPrefix(java.lang.String prefix)
Add a ref prefix to the set that results must match.If an object matches multiple refs equally well, the first matching ref added with
addRef(Ref)is preferred, or else the first matching prefix added byaddPrefix(String).- Parameters:
prefix- prefix to add; the prefix must end with a slash- Returns:
this
-
addAnnotatedTags
public NameRevCommand addAnnotatedTags()
Add all annotated tags underrefs/tags/to the set that all results must match.Calls
addRef(Ref); see that method for a note on matching priority.- Returns:
this- Throws:
JGitInternalException- a low-level exception of JGit has occurred. The original exception can be retrieved by callingThrowable.getCause().
-
addRef
public NameRevCommand addRef(Ref ref)
Add a ref to the set that all results must match.If an object matches multiple refs equally well, the first matching ref added with
addRef(Ref)is preferred, or else the first matching prefix added byaddPrefix(String).- Parameters:
ref- ref to add.- Returns:
this
-
setMergeCost
NameRevCommand setMergeCost(int cost)
-
addPrefixes
private void addPrefixes(java.util.Map<ObjectId,java.lang.String> nonCommits, FIFORevQueue pending) throws java.io.IOException
- Throws:
java.io.IOException
-
addPrefix
private void addPrefix(java.lang.String prefix, java.util.Map<ObjectId,java.lang.String> nonCommits, FIFORevQueue pending) throws java.io.IOException- Throws:
java.io.IOException
-
addRef
private void addRef(Ref ref, java.util.Map<ObjectId,java.lang.String> nonCommits, FIFORevQueue pending) throws java.io.IOException
- Throws:
java.io.IOException
-
minCommitTime
private int minCommitTime() throws java.io.IOException- Throws:
java.io.IOException
-
compare
private long compare(java.lang.String leftTip, long leftCost, java.lang.String rightTip, long rightCost)
-
simplify
private static java.lang.String simplify(java.lang.String refName)
-
-