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

public Class StrategySimpleTwoWayInCore

extends ThreeWayMergeStrategy
Class Inheritance
Imports
java.io.IOException, org.eclipse.jgit.dircache.DirCache, .DirCacheBuilder, .DirCacheEntry, org.eclipse.jgit.errors.UnmergedPathException, org.eclipse.jgit.lib.Config, .FileMode, .ObjectId, .ObjectInserter, .Repository, org.eclipse.jgit.treewalk.AbstractTreeIterator, .NameConflictTreeWalk

Merges two commits together in-memory, ignoring any working directory.

The strategy chooses a path from one of the two input trees if the path is unchanged in the other relative to their common merge base tree. This is a trivial 3-way merge (at the file path level only).

Modifications of the same file path (content and/or file mode) by both input trees will cause a merge conflict, as this strategy does not attempt to merge file contents.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Constructor Summary

AccessConstructor and Description
protected
StrategySimpleTwoWayInCore()

Create a new instance of the strategy.

Method Summary

Modifier and TypeMethod and Description
public String
getName()

Implements abstract org.eclipse.jgit.merge.MergeStrategy.getName.

Get default name of this strategy implementation.

public ThreeWayMerger
newMerger(Repository
repository database the merger will read from, and eventually write results back to.
db
)

Implements abstract org.eclipse.jgit.merge.ThreeWayMergeStrategy.newMerger.

Create a new merge instance.

public ThreeWayMerger
newMerger(Repository
repository database the merger will read from, and eventually write results back to.
db
,
boolean
the merge will happen in memory, working folder will not be modified, in case of a non-trivial merge that requires manual resolution, the merger will fail.
inCore
)

Implements abstract org.eclipse.jgit.merge.ThreeWayMergeStrategy.newMerger.

Create a new merge instance.

public ThreeWayMerger
newMerger(ObjectInserter
inserter to write results back to.
inserter
,
Config
repo config for reading diff algorithm settings.
config
)

Implements abstract org.eclipse.jgit.merge.MergeStrategy.newMerger.

Create a new merge instance.

Constructor Detail

StrategySimpleTwoWayInCoreback to summary
protected StrategySimpleTwoWayInCore()

Create a new instance of the strategy.

Method Detail

getNameback to summary
public String getName()

Implements abstract org.eclipse.jgit.merge.MergeStrategy.getName.

Doc from org.eclipse.jgit.merge.MergeStrategy.getName.

Get default name of this strategy implementation.

Returns:String

default name of this strategy implementation.

Annotations
@Override
newMergerback to summary
public ThreeWayMerger newMerger(Repository db)

Implements abstract org.eclipse.jgit.merge.ThreeWayMergeStrategy.newMerger.

Doc from org.eclipse.jgit.merge.MergeStrategy.newMerger.

Create a new merge instance.

Parameters
db:Repository

repository database the merger will read from, and eventually write results back to.

Returns:ThreeWayMerger

the new merge instance which implements this strategy.

Annotations
@Override
newMergerback to summary
public ThreeWayMerger newMerger(Repository db, boolean inCore)

Implements abstract org.eclipse.jgit.merge.ThreeWayMergeStrategy.newMerger.

Doc from org.eclipse.jgit.merge.MergeStrategy.newMerger.

Create a new merge instance.

Parameters
db:Repository

repository database the merger will read from, and eventually write results back to.

inCore:boolean

the merge will happen in memory, working folder will not be modified, in case of a non-trivial merge that requires manual resolution, the merger will fail.

Returns:ThreeWayMerger

the new merge instance which implements this strategy.

Annotations
@Override
newMergerback to summary
public ThreeWayMerger newMerger(ObjectInserter inserter, Config config)

Implements abstract org.eclipse.jgit.merge.MergeStrategy.newMerger.

Doc from org.eclipse.jgit.merge.MergeStrategy.newMerger.

Create a new merge instance.

The merge will happen in memory, working folder will not be modified, in case of a non-trivial merge that requires manual resolution, the merger will fail.

Parameters
inserter:ObjectInserter

inserter to write results back to.

config:Config

repo config for reading diff algorithm settings.

Returns:ThreeWayMerger

the new merge instance which implements this strategy.

Annotations
@Override
org.eclipse.jgit.merge back to summary

private Class StrategySimpleTwoWayInCore.InCoreMerger

extends ThreeWayMerger
Class Inheritance

Field Summary

Modifier and TypeField and Description
private DirCacheBuilder
private final DirCache
private ObjectId
private static final int
private static final int
private static final int
private final NameConflictTreeWalk

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv

Method Summary

Modifier and TypeMethod and Description
private void
add(int tree, int stage)

public ObjectId
getResultTreeId()

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

Get resulting tree.

private AbstractTreeIterator
getTree(int tree)

protected boolean
mergeImpl()

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

Execute the merge.

private static boolean
nonTree(int mode)

Inherited from org.eclipse.jgit.merge.ThreeWayMerger:
getBaseCommitIdmergemergeBasesetBase

Field Detail

builderback to summary
private DirCacheBuilder builder
cacheback to summary
private final DirCache cache
resultTreeback to summary
private ObjectId resultTree
T_BASEback to summary
private static final int T_BASE
T_OURSback to summary
private static final int T_OURS
T_THEIRSback to summary
private static final int T_THEIRS
twback to summary
private final NameConflictTreeWalk tw

Constructor Detail

InCoreMergerback to summary
pack-priv InCoreMerger(Repository local)
InCoreMergerback to summary
pack-priv InCoreMerger(ObjectInserter inserter)

Method Detail

addback to summary
private void add(int tree, int stage) throws IOException
getResultTreeIdback to summary
public ObjectId getResultTreeId()

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

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

Get resulting tree.

Returns:ObjectId

resulting tree, if merge(AnyObjectId[]) returned true.

Annotations
@Override
getTreeback to summary
private AbstractTreeIterator getTree(int tree)
mergeImplback to summary
protected boolean mergeImpl() throws IOException

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

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

Execute the merge.

This method is called from merge(AnyObjectId[]) after the sourceObjects, sourceCommits and sourceTrees have been populated.

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.
nonTreeback to summary
private static boolean nonTree(int mode)