public abstract class MergeStrategy extends Object
Different strategies may employ different techniques for deciding which paths (and ObjectIds) to carry from the input trees into the final output tree.
Modifier and Type | Field and Description |
---|---|
static MergeStrategy |
OURS
Simple strategy that sets the output tree to the first input tree.
|
static ThreeWayMergeStrategy |
RECURSIVE
Recursive strategy to merge paths.
|
static ThreeWayMergeStrategy |
RESOLVE
Simple strategy to merge paths.
|
static ThreeWayMergeStrategy |
SIMPLE_TWO_WAY_IN_CORE
Simple strategy to merge paths, without simultaneous edits.
|
static MergeStrategy |
THEIRS
Simple strategy that sets the output tree to the second input tree.
|
Constructor and Description |
---|
MergeStrategy() |
Modifier and Type | Method and Description |
---|---|
static MergeStrategy[] |
get()
Get all registered strategies.
|
static MergeStrategy |
get(String name)
Locate a strategy by name.
|
abstract String |
getName()
Get default name of this strategy implementation.
|
abstract Merger |
newMerger(ObjectInserter inserter,
Config config)
Create a new merge instance.
|
abstract Merger |
newMerger(Repository db)
Create a new merge instance.
|
abstract Merger |
newMerger(Repository db,
boolean inCore)
Create a new merge instance.
|
static void |
register(MergeStrategy imp)
Register a merge strategy so it can later be obtained by name.
|
static void |
register(String name,
MergeStrategy imp)
Register a merge strategy so it can later be obtained by name.
|
public static final MergeStrategy OURS
public static final MergeStrategy THEIRS
public static final ThreeWayMergeStrategy SIMPLE_TWO_WAY_IN_CORE
public static final ThreeWayMergeStrategy RESOLVE
public static final ThreeWayMergeStrategy RECURSIVE
public static void register(MergeStrategy imp)
imp
- the strategy to register.IllegalArgumentException
- a strategy by the same name has already been registered.public static void register(String name, MergeStrategy imp)
name
- name the strategy can be looked up under.imp
- the strategy to register.IllegalArgumentException
- a strategy by the same name has already been registered.public static MergeStrategy get(String name)
name
- name of the strategy to locate.public static MergeStrategy[] get()
public abstract String getName()
public abstract Merger newMerger(Repository db)
db
- repository database the merger will read from, and eventually
write results back to.public abstract Merger newMerger(Repository db, boolean inCore)
db
- repository database the merger will read from, and eventually
write results back to.inCore
- 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.public abstract Merger newMerger(ObjectInserter inserter, Config config)
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.
inserter
- inserter to write results back to.config
- repo config for reading diff algorithm settings.Copyright © 2019 Eclipse JGit Project. All rights reserved.