public abstract class Merger
extends java.lang.Object
MergeStrategy for a single Repository.| Modifier and Type | Field and Description |
|---|---|
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.
|
| Modifier | Constructor and Description |
|---|---|
protected |
Merger(Repository local)
Create a new merge instance for a repository.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
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.protected Merger(Repository local)
local - the repository this merger will read and write data on.public Repository getRepository()
public ObjectInserter getObjectInserter()
getRepository().public boolean merge(AnyObjectId... tips) throws java.io.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.java.io.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 java.io.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.java.io.IOException - objects are missing or multiple merge bases were found.public RevCommit getBaseCommit(int aIdx, int bIdx) throws IncorrectObjectTypeException, java.io.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.java.io.IOException - objects are missing or multiple merge bases were found.protected AbstractTreeIterator openTree(AnyObjectId treeId) throws IncorrectObjectTypeException, java.io.IOException
treeId - the tree to scan; must be a tree (not a treeish).IncorrectObjectTypeException - the input object is not a tree.java.io.IOException - the tree object is not found or cannot be read.protected abstract boolean mergeImpl()
throws java.io.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.java.io.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.Copyright © 2012. All Rights Reserved.