Top Description Inners Fields Constructors Methods
org.eclipse.jgit.api

public Class NameRevCommand

extends GitCommand<Map<ObjectId, String>>
Class Inheritance
Imports
java.io.IOException, java.util.ArrayList, .HashMap, .LinkedHashMap, .List, .Map, org.eclipse.jgit.api.errors.GitAPIException, .JGitInternalException, org.eclipse.jgit.errors.MissingObjectException, org.eclipse.jgit.lib.AnyObjectId, .Constants, .ObjectId, .Ref, .Repository, org.eclipse.jgit.revwalk.FIFORevQueue, .RevCommit, .RevObject, .RevTag, .RevWalk

Command to find human-readable names of revisions.
Since
3.0
See Also
Git documentation about name-rev

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final int
COMMIT_TIME_SLOP

Amount of slop to allow walking past the earliest requested commit.

private static final int
MERGE_COST

Cost of traversing a merge commit compared to a linear history.

private int
private final List<String>
private List<Ref>
private final List<ObjectId>
private final RevWalk
Inherited from org.eclipse.jgit.api.GitCommand:
repo

Constructor Summary

AccessConstructor and Description
protected
NameRevCommand(Repository repo)

Create a new name-rev command.

Method Summary

Modifier and TypeMethod and Description
public NameRevCommand

Returns:

this
add
(ObjectId
object ID to add.
id
)

Add an object to search for.

public NameRevCommand

Returns:

this
add
(Iterable<ObjectId>
object IDs to add.
ids
)

Add multiple objects to search for.

public NameRevCommand

Returns:

this
addAnnotatedTags
()

Add all annotated tags under refs/tags/ to the set that all results must match.

public NameRevCommand

Returns:

this
addPrefix
(String
prefix to add; the prefix must end with a slash
prefix
)

Add a ref prefix to the set that results must match.

private void
addPrefix(String prefix, Map<ObjectId, String> nonCommits, FIFORevQueue pending)

private void
addPrefixes(Map<ObjectId, String> nonCommits, FIFORevQueue pending)

public NameRevCommand

Returns:

this
addRef
(Ref
ref to add.
ref
)

Add a ref to the set that all results must match.

private void
addRef(Ref ref, Map<ObjectId, String> nonCommits, FIFORevQueue pending)

public Map<ObjectId, String>
call()

Implements abstract org.eclipse.jgit.api.GitCommand.call.

Implements java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

private long
compare(String leftTip, long leftCost, String rightTip, long rightCost)

private int
pack-priv NameRevCommand
setMergeCost(int cost)

private static String
simplify(String refName)

Inherited from org.eclipse.jgit.api.GitCommand:
checkCallablegetRepositorysetCallable

Field Detail

COMMIT_TIME_SLOPback to summary
private static final int COMMIT_TIME_SLOP

Amount of slop to allow walking past the earliest requested commit.

MERGE_COSTback to summary
private static final int MERGE_COST

Cost of traversing a merge commit compared to a linear history.

mergeCostback to summary
private int mergeCost
prefixesback to summary
private final List<String> prefixes
refsback to summary
private List<Ref> refs
revsback to summary
private final List<ObjectId> revs
walkback to summary
private final RevWalk walk

Constructor Detail

NameRevCommandback to summary
protected NameRevCommand(Repository repo)

Create a new name-rev command.

Parameters
repo:Repository

the org.eclipse.jgit.lib.Repository

Method Detail

addback to summary
public NameRevCommand add(ObjectId id) throws MissingObjectException, JGitInternalException

Add an object to search for.

Parameters
id:ObjectId

object ID to add.

Returns:NameRevCommand

this

Exceptions
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 calling java.lang.Exception#getCause().
addback to summary
public NameRevCommand add(Iterable<ObjectId> ids) throws MissingObjectException, JGitInternalException

Add multiple objects to search for.

Parameters
ids:Iterable<ObjectId>

object IDs to add.

Returns:NameRevCommand

this

Exceptions
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 calling java.lang.Exception#getCause().
addAnnotatedTagsback to summary
public NameRevCommand addAnnotatedTags()

Add all annotated tags under refs/tags/ to the set that all results must match.

Calls addRef(Ref); see that method for a note on matching priority.

Returns:NameRevCommand

this

Exceptions
JGitInternalException:
a low-level exception of JGit has occurred. The original exception can be retrieved by calling java.lang.Exception#getCause().
addPrefixback to summary
public NameRevCommand addPrefix(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 by addPrefix(String).

Parameters
prefix:String

prefix to add; the prefix must end with a slash

Returns:NameRevCommand

this

addPrefixback to summary
private void addPrefix(String prefix, Map<ObjectId, String> nonCommits, FIFORevQueue pending) throws IOException
addPrefixesback to summary
private void addPrefixes(Map<ObjectId, String> nonCommits, FIFORevQueue pending) throws IOException
addRefback to summary
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 by addPrefix(String).

Parameters
ref:Ref

ref to add.

Returns:NameRevCommand

this

addRefback to summary
private void addRef(Ref ref, Map<ObjectId, String> nonCommits, FIFORevQueue pending) throws IOException
callback to summary
public Map<ObjectId, String> call() throws GitAPIException

Implements abstract org.eclipse.jgit.api.GitCommand.call.

Implements java.util.concurrent.Callable.call.

Doc from org.eclipse.jgit.api.GitCommand.call.

Computes a result, or throws an exception if unable to do so.

Execute the command

Returns:Map<ObjectId, String>

Doc from java.util.concurrent.Callable.call.

computed result

Annotations
@Override
compareback to summary
private long compare(String leftTip, long leftCost, String rightTip, long rightCost)
minCommitTimeback to summary
private int minCommitTime() throws IOException
setMergeCostback to summary
pack-priv NameRevCommand setMergeCost(int cost)
simplifyback to summary
private static String simplify(String refName)
org.eclipse.jgit.api back to summary

private Class NameRevCommand.NameRevCommit

extends RevCommit
Class Inheritance

Field Summary

Modifier and TypeField and Description
private long
private int
private String
Inherited from org.eclipse.jgit.revwalk.RevCommit:
bufferparentstree

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private StringBuilder
public String
toString()

Overrides org.eclipse.jgit.revwalk.RevCommit.toString.

Returns a string representation of the object.

Inherited from org.eclipse.jgit.revwalk.RevCommit:
carrydisposeBodygetAuthorIdentgetChangedPathFiltergetCommitterIdentgetCommitTimegetEncodinggetEncodingNamegetFirstMessageLinegetFooterLinesgetFooterLinesgetFooterLinesgetFullMessagegetParentgetParentCountgetParentsgetRawBuffergetRawGpgSignaturegetShortMessagegetTreegetTypeparseparsereset

Field Detail

costback to summary
private long cost
distanceback to summary
private int distance
tipback to summary
private String tip

Constructor Detail

NameRevCommitback to summary
private NameRevCommit(AnyObjectId id)

Method Detail

formatback to summary
private StringBuilder format()
toStringback to summary
public String toString()

Overrides org.eclipse.jgit.revwalk.RevCommit.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override