public class MergeResult
extends java.lang.Object
MergeCommand.| Modifier and Type | Class and Description |
|---|---|
static class |
MergeResult.MergeStatus
The status the merge resulted in.
|
| Modifier and Type | Field and Description |
|---|---|
private ObjectId |
base |
private java.util.List<java.lang.String> |
checkoutConflicts |
private java.util.Map<java.lang.String,int[][]> |
conflicts |
private java.lang.String |
description |
private java.util.Map<java.lang.String,ResolveMerger.MergeFailureReason> |
failingPaths |
private ObjectId[] |
mergedCommits |
private MergeResult.MergeStatus |
mergeStatus |
private MergeStrategy |
mergeStrategy |
private ObjectId |
newHead |
| Constructor and Description |
|---|
MergeResult(java.util.List<java.lang.String> checkoutConflicts)
Creates a new result that represents a checkout conflict before the
operation even started for real.
|
MergeResult(ObjectId newHead,
ObjectId base,
ObjectId[] mergedCommits,
MergeResult.MergeStatus mergeStatus,
MergeStrategy mergeStrategy,
java.util.Map<java.lang.String,MergeResult<?>> lowLevelResults)
Constructor for MergeResult.
|
MergeResult(ObjectId newHead,
ObjectId base,
ObjectId[] mergedCommits,
MergeResult.MergeStatus mergeStatus,
MergeStrategy mergeStrategy,
java.util.Map<java.lang.String,MergeResult<?>> lowLevelResults,
java.util.Map<java.lang.String,ResolveMerger.MergeFailureReason> failingPaths,
java.lang.String description)
Constructor for MergeResult.
|
MergeResult(ObjectId newHead,
ObjectId base,
ObjectId[] mergedCommits,
MergeResult.MergeStatus mergeStatus,
MergeStrategy mergeStrategy,
java.util.Map<java.lang.String,MergeResult<?>> lowLevelResults,
java.lang.String description)
Constructor for MergeResult.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addConflict(java.lang.String path,
int[][] conflictingRanges)
Add a conflict
|
void |
addConflict(java.lang.String path,
MergeResult<?> lowLevelResult)
Add a conflict
|
ObjectId |
getBase()
Get the common base
|
java.util.List<java.lang.String> |
getCheckoutConflicts()
Returns a list of paths that cause a checkout conflict.
|
java.util.Map<java.lang.String,int[][]> |
getConflicts()
Returns information about the conflicts which occurred during a
MergeCommand. |
java.util.Map<java.lang.String,ResolveMerger.MergeFailureReason> |
getFailingPaths()
Returns a list of paths causing this merge to fail as returned by
ResolveMerger.getFailingPaths() |
ObjectId[] |
getMergedCommits()
Get the commits which have been merged
|
MergeResult.MergeStatus |
getMergeStatus()
Get the merge status
|
ObjectId |
getNewHead()
Get the object the head points at after the merge
|
void |
setConflicts(java.util.Map<java.lang.String,int[][]> conflicts)
Set conflicts
|
java.lang.String |
toString() |
private ObjectId[] mergedCommits
private ObjectId base
private ObjectId newHead
private java.util.Map<java.lang.String,int[][]> conflicts
private MergeResult.MergeStatus mergeStatus
private java.lang.String description
private MergeStrategy mergeStrategy
private java.util.Map<java.lang.String,ResolveMerger.MergeFailureReason> failingPaths
private java.util.List<java.lang.String> checkoutConflicts
public MergeResult(ObjectId newHead, ObjectId base, ObjectId[] mergedCommits, MergeResult.MergeStatus mergeStatus, MergeStrategy mergeStrategy, java.util.Map<java.lang.String,MergeResult<?>> lowLevelResults)
newHead - the object the head points at after the mergebase - the common base which was used to produce a content-merge. May
be null if the merge-result was produced without
computing a common basemergedCommits - all the commits which have been merged togethermergeStatus - the status the merge resulted inmergeStrategy - the used MergeStrategylowLevelResults - merge results as returned by
ResolveMerger.getMergeResults()public MergeResult(ObjectId newHead, ObjectId base, ObjectId[] mergedCommits, MergeResult.MergeStatus mergeStatus, MergeStrategy mergeStrategy, java.util.Map<java.lang.String,MergeResult<?>> lowLevelResults, java.lang.String description)
newHead - the object the head points at after the mergebase - the common base which was used to produce a content-merge. May
be null if the merge-result was produced without
computing a common basemergedCommits - all the commits which have been merged togethermergeStatus - the status the merge resulted inmergeStrategy - the used MergeStrategylowLevelResults - merge results as returned by
ResolveMerger.getMergeResults()description - a user friendly description of the merge resultpublic MergeResult(ObjectId newHead, ObjectId base, ObjectId[] mergedCommits, MergeResult.MergeStatus mergeStatus, MergeStrategy mergeStrategy, java.util.Map<java.lang.String,MergeResult<?>> lowLevelResults, java.util.Map<java.lang.String,ResolveMerger.MergeFailureReason> failingPaths, java.lang.String description)
newHead - the object the head points at after the mergebase - the common base which was used to produce a content-merge. May
be null if the merge-result was produced without
computing a common basemergedCommits - all the commits which have been merged togethermergeStatus - the status the merge resulted inmergeStrategy - the used MergeStrategylowLevelResults - merge results as returned by
ResolveMerger.getMergeResults()failingPaths - list of paths causing this merge to fail as returned by
ResolveMerger.getFailingPaths()description - a user friendly description of the merge resultpublic MergeResult(java.util.List<java.lang.String> checkoutConflicts)
checkoutConflicts - the conflicting filespublic ObjectId getNewHead()
public MergeResult.MergeStatus getMergeStatus()
public ObjectId[] getMergedCommits()
public ObjectId getBase()
null if the merge-result was produced without
computing a common basepublic java.lang.String toString()
toString in class java.lang.Objectpublic void setConflicts(java.util.Map<java.lang.String,int[][]> conflicts)
conflicts - the conflicts to setpublic void addConflict(java.lang.String path,
int[][] conflictingRanges)
path - path of the file to add a conflict forconflictingRanges - the conflicts to setpublic void addConflict(java.lang.String path,
MergeResult<?> lowLevelResult)
path - path of the file to add a conflict forlowLevelResult - a MergeResultpublic java.util.Map<java.lang.String,int[][]> getConflicts()
MergeCommand. The returned value maps the
path of a conflicting file to a two-dimensional int-array of line-numbers
telling where in the file conflict markers for which merged commit can be
found.
If the returned value contains a mapping "path"->[x][y]=z then this means
Example code how to parse this data:
MergeResult m=...;
Map<String, int[][]> allConflicts = m.getConflicts();
for (String path : allConflicts.keySet()) {
int[][] c = allConflicts.get(path);
System.out.println("Conflicts in file " + path);
for (int i = 0; i < c.length; ++i) {
System.out.println(" Conflict #" + i);
for (int j = 0; j < (c[i].length) - 1; ++j) {
if (c[i][j] >= 0)
System.out.println(" Chunk for "
+ m.getMergedCommits()[j] + " starts on line #"
+ c[i][j]);
}
}
}
null if no conflict occurredpublic java.util.Map<java.lang.String,ResolveMerger.MergeFailureReason> getFailingPaths()
ResolveMerger.getFailingPaths()null
if no failure occurredpublic java.util.List<java.lang.String> getCheckoutConflicts()