|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jgit.merge.Merger
public abstract class Merger
Instance of a specific MergeStrategy
for a single Repository
.
Field Summary | |
---|---|
protected Repository |
db
The repository this merger operates on. |
protected ObjectReader |
reader
Reader to support walk and other object loading. |
protected RevCommit[] |
sourceCommits
If sourceObjects [i] is a commit, this is the commit. |
protected RevObject[] |
sourceObjects
The original objects supplied in the merge; this can be any tree-ish. |
protected RevTree[] |
sourceTrees
The trees matching every entry in sourceObjects . |
protected RevWalk |
walk
A RevWalk for computing merge bases, or listing incoming commits. |
Constructor Summary | |
---|---|
protected |
Merger(Repository local)
Create a new merge instance for a repository. |
Method Summary | |
---|---|
RevCommit |
getBaseCommit(int aIdx,
int bIdx)
Return the merge base of two commits. |
ObjectInserter |
getObjectInserter()
|
Repository |
getRepository()
|
abstract ObjectId |
getResultTreeId()
|
boolean |
merge(AnyObjectId... tips)
Merge together two or more tree-ish objects. |
protected AbstractTreeIterator |
mergeBase(int aIdx,
int bIdx)
Create an iterator to walk the merge base of two commits. |
protected abstract boolean |
mergeImpl()
Execute the merge. |
protected AbstractTreeIterator |
openTree(AnyObjectId treeId)
Open an iterator over a tree. |
void |
setObjectInserter(ObjectInserter oi)
Set the inserter this merger will use to create objects. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Repository db
protected final ObjectReader reader
walk
and other object loading.
protected final RevWalk walk
protected RevObject[] sourceObjects
protected RevCommit[] sourceCommits
sourceObjects
[i] is a commit, this is the commit.
protected RevTree[] sourceTrees
sourceObjects
.
Constructor Detail |
---|
protected Merger(Repository local)
local
- the repository this merger will read and write data on.Method Detail |
---|
public Repository getRepository()
public ObjectInserter getObjectInserter()
getRepository()
.
If no inserter has been set on this instance, one will be created
and returned by all future calls.public void setObjectInserter(ObjectInserter oi)
If an inserter was already set on this instance (such as by a prior set,
or a prior call to getObjectInserter()
), the prior inserter will
be released first.
oi
- the inserter instance to use. Must be associated with the
repository instance returned by getRepository()
.public boolean merge(AnyObjectId... tips) throws IOException
Any tree-ish may be supplied as inputs. Commits and/or tags pointing at trees or commits may be passed as input objects.
tips
- source trees to be combined together. The merge base is not
included in this set.
IncorrectObjectTypeException
- one of the input objects is not a commit, but the strategy
requires it to be a commit.
IOException
- one or more sources could not be read, or outputs could not
be written to the Repository.protected AbstractTreeIterator mergeBase(int aIdx, int bIdx) throws IOException
aIdx
- index of the first commit in sourceObjects
.bIdx
- index of the second commit in sourceObjects
.
IncorrectObjectTypeException
- one of the input objects is not a commit.
IOException
- objects are missing or multiple merge bases were found.public RevCommit getBaseCommit(int aIdx, int bIdx) throws IncorrectObjectTypeException, IOException
aIdx
- index of the first commit in sourceObjects
.bIdx
- index of the second commit in sourceObjects
.
IncorrectObjectTypeException
- one of the input objects is not a commit.
IOException
- objects are missing or multiple merge bases were found.protected AbstractTreeIterator openTree(AnyObjectId treeId) throws IncorrectObjectTypeException, IOException
treeId
- the tree to scan; must be a tree (not a treeish).
IncorrectObjectTypeException
- the input object is not a tree.
IOException
- the tree object is not found or cannot be read.protected abstract boolean mergeImpl() throws IOException
This method is called from merge(AnyObjectId[])
after the
sourceObjects
, sourceCommits
and sourceTrees
have been populated.
IncorrectObjectTypeException
- one of the input objects is not a commit, but the strategy
requires it to be a commit.
IOException
- one or more sources could not be read, or outputs could not
be written to the Repository.public abstract ObjectId getResultTreeId()
merge(AnyObjectId[])
returned true.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |