Top Description Fields Constructors Methods
org.eclipse.jgit.internal.storage.commitgraph

pack-priv Class CommitGraphV1

extends Object
implements CommitGraph
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.internal.storage.commitgraph.CommitGraph
Imports
org.eclipse.jgit.lib.AnyObjectId, .ObjectId

Support for the commit-graph v1 format.
See Also
CommitGraph

Field Summary

Modifier and TypeField and Description
private final GraphCommitData
private final GraphChangedPathFilterData
private final GraphObjectIndex

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public int
findGraphPosition(AnyObjectId
the commit for which the commit-graph position will be found.
commit
)

Implements org.eclipse.jgit.internal.storage.commitgraph.CommitGraph.findGraphPosition.

Find the position in the commit-graph of the commit.

public ChangedPathFilter
getChangedPathFilter(int
the position in the commit-graph of the object.
graphPos
)

Implements org.eclipse.jgit.internal.storage.commitgraph.CommitGraph.getChangedPathFilter.

Get the changed path filter of the object at the commit-graph position.

public long
getCommitCnt()

Implements org.eclipse.jgit.internal.storage.commitgraph.CommitGraph.getCommitCnt.

Obtain the total number of commits described by this commit-graph.

public CommitGraph.CommitData
getCommitData(int
the position in the commit-graph of the object.
graphPos
)

Implements org.eclipse.jgit.internal.storage.commitgraph.CommitGraph.getCommitData.

Get the metadata of a commit。

This function runs in time O(1).

public ObjectId
getObjectId(int
the position in the commit-graph of the object.
graphPos
)

Implements org.eclipse.jgit.internal.storage.commitgraph.CommitGraph.getObjectId.

Get the object at the commit-graph position.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

commitDataback to summary
private final GraphCommitData commitData
cpfDataback to summary
private final GraphChangedPathFilterData cpfData
idxback to summary
private final GraphObjectIndex idx

Constructor Detail

CommitGraphV1back to summary
pack-priv CommitGraphV1(GraphObjectIndex index, GraphCommitData commitData, GraphChangedPathFilterData cpfData)

Method Detail

findGraphPositionback to summary
public int findGraphPosition(AnyObjectId commit)

Implements org.eclipse.jgit.internal.storage.commitgraph.CommitGraph.findGraphPosition.

Doc from org.eclipse.jgit.internal.storage.commitgraph.CommitGraph.findGraphPosition.

Find the position in the commit-graph of the commit.

The position can only be used within the CommitGraph Instance you got it from. That's because the graph position of the same commit may be different in CommitGraph obtained at different times (eg., regenerated new commit-graph).

Parameters
commit:AnyObjectId

the commit for which the commit-graph position will be found.

Returns:int

the commit-graph position or -1 if the object was not found.

Annotations
@Override
getChangedPathFilterback to summary
public ChangedPathFilter getChangedPathFilter(int graphPos)

Implements org.eclipse.jgit.internal.storage.commitgraph.CommitGraph.getChangedPathFilter.

Doc from org.eclipse.jgit.internal.storage.commitgraph.CommitGraph.getChangedPathFilter.

Get the changed path filter of the object at the commit-graph position.

Parameters
graphPos:int

the position in the commit-graph of the object.

Returns:ChangedPathFilter

the bloom filter or null if it's not found.

Annotations
@Override
getCommitCntback to summary
public long getCommitCnt()

Implements org.eclipse.jgit.internal.storage.commitgraph.CommitGraph.getCommitCnt.

Doc from org.eclipse.jgit.internal.storage.commitgraph.CommitGraph.getCommitCnt.

Obtain the total number of commits described by this commit-graph.

Returns:long

number of commits in this commit-graph.

Annotations
@Override
getCommitDataback to summary
public CommitGraph.CommitData getCommitData(int graphPos)

Implements org.eclipse.jgit.internal.storage.commitgraph.CommitGraph.getCommitData.

Doc from org.eclipse.jgit.internal.storage.commitgraph.CommitGraph.getCommitData.

Get the metadata of a commit。

This function runs in time O(1).

In the process of commit history traversal, CommitData#getParents() makes us get the graphPos of the commit's parents in advance, so that we can avoid O(logN) lookup and use O(1) lookup instead.

Parameters
graphPos:int

the position in the commit-graph of the object.

Returns:CommitGraph.CommitData

the metadata of a commit or null if it's not found.

Annotations
@Override
getObjectIdback to summary
public ObjectId getObjectId(int graphPos)

Implements org.eclipse.jgit.internal.storage.commitgraph.CommitGraph.getObjectId.

Doc from org.eclipse.jgit.internal.storage.commitgraph.CommitGraph.getObjectId.

Get the object at the commit-graph position.

Parameters
graphPos:int

the position in the commit-graph of the object.

Returns:ObjectId

the ObjectId or null if it's not found.

Annotations
@Override