Top Description Fields Constructors Methods
org.eclipse.jgit.merge

public abstract Class ThreeWayMerger

extends Merger
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.merge.ResolveMerger, org.eclipse.jgit.merge.StrategySimpleTwoWayInCore.InCoreMerger
Imports
java.io.IOException, org.eclipse.jgit.errors.IncorrectObjectTypeException, .MissingObjectException, org.eclipse.jgit.lib.AnyObjectId, .ObjectId, .ObjectInserter, .Repository, org.eclipse.jgit.revwalk.RevCommit, .RevTree, org.eclipse.jgit.treewalk.AbstractTreeIterator, .EmptyTreeIterator

A merge of 2 trees, using a common base ancestor tree.

Field Summary

Modifier and TypeField and Description
private ObjectId
private RevTree
Inherited from org.eclipse.jgit.merge.Merger:
dbmonitorreadersourceCommitssourceObjectssourceTreeswalk

Constructor Summary

AccessConstructor and Description
protected
ThreeWayMerger(Repository
the repository this merger will read and write data on.
local
)

Create a new merge instance for a repository.

protected
ThreeWayMerger(Repository
the repository this merger will read and write data on.
local
,
boolean
perform the merge in core with no working folder involved
inCore
)

Create a new merge instance for a repository.

protected
ThreeWayMerger(ObjectInserter
the inserter to write objects to.
inserter
)

Create a new in-core merge instance from an inserter.

Method Summary

Modifier and TypeMethod and Description
public ObjectId
getBaseCommitId()

Implements abstract org.eclipse.jgit.merge.Merger.getBaseCommitId.

Get the ID of the commit that was used as merge base for merging

public boolean
merge(AnyObjectId...
source trees to be combined together. The merge base is not included in this set.
tips
)

Overrides org.eclipse.jgit.merge.Merger.merge.

Merge together two or more tree-ish objects.

protected AbstractTreeIterator

Returns:

an iterator over the caller-specified merge base, or the natural merge base of the two input commits.
mergeBase
()

Create an iterator to walk the merge base.

public void
setBase(AnyObjectId
common base treeish; null to automatically compute the common base from the input commits during merge(AnyObjectId...).
id
)

Set the common ancestor tree.

Inherited from org.eclipse.jgit.merge.Merger:
getBaseCommitgetObjectInsertergetRepositorygetResultTreeIdmergemergeImplnonNullRepoopenTreesetObjectInsertersetProgressMonitor

Field Detail

baseCommitIdback to summary
private ObjectId baseCommitId
baseTreeback to summary
private RevTree baseTree

Constructor Detail

ThreeWayMergerback to summary
protected ThreeWayMerger(Repository local)

Create a new merge instance for a repository.

Parameters
local:Repository

the repository this merger will read and write data on.

ThreeWayMergerback to summary
protected ThreeWayMerger(Repository local, boolean inCore)

Create a new merge instance for a repository.

Parameters
local:Repository

the repository this merger will read and write data on.

inCore:boolean

perform the merge in core with no working folder involved

ThreeWayMergerback to summary
protected ThreeWayMerger(ObjectInserter inserter)

Create a new in-core merge instance from an inserter.

Parameters
inserter:ObjectInserter

the inserter to write objects to.

Since
4.8

Method Detail

getBaseCommitIdback to summary
public ObjectId getBaseCommitId()

Implements abstract org.eclipse.jgit.merge.Merger.getBaseCommitId.

Doc from org.eclipse.jgit.merge.Merger.getBaseCommitId.

Get the ID of the commit that was used as merge base for merging

Returns:ObjectId

the ID of the commit that was used as merge base for merging, or null if no merge base was used or it was set manually

Annotations
@Override
mergeback to summary
public boolean merge(AnyObjectId... tips) throws IOException

Overrides org.eclipse.jgit.merge.Merger.merge.

Doc from org.eclipse.jgit.merge.Merger.merge.

Merge together two or more tree-ish objects.

Any tree-ish may be supplied as inputs. Commits and/or tags pointing at trees or commits may be passed as input objects.

Parameters
tips:AnyObjectId[]

source trees to be combined together. The merge base is not included in this set.

Returns:boolean

true if the merge was completed without conflicts; false if the merge strategy cannot handle this merge or there were conflicts preventing it from automatically resolving all paths.

Annotations
@Override
Exceptions
IOException:
one or more sources could not be read, or outputs could not be written to the Repository.
mergeBaseback to summary
protected AbstractTreeIterator mergeBase() throws IOException

Create an iterator to walk the merge base.

Returns:AbstractTreeIterator

an iterator over the caller-specified merge base, or the natural merge base of the two input commits.

Exceptions
IOException:
if an IO error occurred
setBaseback to summary
public void setBase(AnyObjectId id) throws MissingObjectException, IncorrectObjectTypeException, IOException

Set the common ancestor tree.

Parameters
id:AnyObjectId

common base treeish; null to automatically compute the common base from the input commits during merge(AnyObjectId...).

Exceptions
MissingObjectException:
the object does not exist.
IncorrectObjectTypeException:
the object is not a treeish.
IOException:
the object could not be read.