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

public Class NoteMapMerger

extends Object
Class Inheritance
Imports
java.io.IOException, org.eclipse.jgit.errors.MissingObjectException, org.eclipse.jgit.lib.AbbreviatedObjectId, .AnyObjectId, .MutableObjectId, .ObjectId, .ObjectInserter, .ObjectReader, .Repository, org.eclipse.jgit.merge.MergeStrategy, .Merger, .ThreeWayMerger

Three-way note tree merge.

Direct implementation of NoteMap merger without using org.eclipse.jgit.treewalk.TreeWalk and org.eclipse.jgit.treewalk.AbstractTreeIterator

Field Summary

Modifier and TypeField and Description
private final Repository
private static final FanoutBucket
private static final LeafBucket
private final ObjectInserter
private final MergeStrategy
private final NoteMerger
private final MutableObjectId
private final ObjectReader

Constructor Summary

AccessConstructor and Description
public
NoteMapMerger(Repository
Git repository
db
,
NoteMerger
note merger for merging conflicting changes on a note
noteMerger
,
MergeStrategy
merge strategy for merging non-note entries
nonNotesMergeStrategy
)

Constructs a NoteMapMerger with custom org.eclipse.jgit.notes.NoteMerger and custom org.eclipse.jgit.merge.MergeStrategy.

public
NoteMapMerger(Repository
Git repository
db
)

Constructs a NoteMapMerger with org.eclipse.jgit.notes.DefaultNoteMerger as the merger for notes and the org.eclipse.jgit.merge.MergeStrategy#RESOLVE as the strategy for resolving conflicts on non-notes

Method Summary

Modifier and TypeMethod and Description
private void
addIfNotNull(FanoutBucket b, int cell, NoteBucket child)

private static InMemoryNoteBucket
private FanoutBucket
private static boolean
private static Note
get(LeafBucket b, int i)

public NoteMap

Returns:

merge result as a new NoteMap
merge
(NoteMap
base version of the note tree
base
,
NoteMap
ours version of the note tree
ours
,
NoteMap
theirs version of the note tree
theirs
)

Performs the merge.

private InMemoryNoteBucket

Returns:

merge result as an InMemoryBucket
merge
(int
depth of the tree
treeDepth
,
InMemoryNoteBucket
base version
base
,
InMemoryNoteBucket
ours version
ours
,
InMemoryNoteBucket
theirs version
theirs
)

This method is called only when it is known that there is some difference between base, ours and theirs.

private InMemoryNoteBucket
mergeFanoutBucket(int treeDepth, FanoutBucket base, FanoutBucket ours, FanoutBucket theirs)

private InMemoryNoteBucket
mergeLeafBucket(int treeDepth, LeafBucket bb, LeafBucket ob, LeafBucket tb)

private NonNoteEntry
mergeNonNotes(NonNoteEntry baseList, NonNoteEntry oursList, NonNoteEntry theirsList)

private static Note
min(Note b, Note o, Note t)

private static NonNoteEntry
private static LeafBucket
private static boolean
private static boolean
private static Note
sameNoteOrNull(Note min, Note other)

private ObjectId
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dbback to summary
private final Repository db
EMPTY_FANOUTback to summary
private static final FanoutBucket EMPTY_FANOUT
EMPTY_LEAFback to summary
private static final LeafBucket EMPTY_LEAF
inserterback to summary
private final ObjectInserter inserter
nonNotesMergeStrategyback to summary
private final MergeStrategy nonNotesMergeStrategy
noteMergerback to summary
private final NoteMerger noteMerger
objectIdPrefixback to summary
private final MutableObjectId objectIdPrefix
readerback to summary
private final ObjectReader reader

Constructor Detail

NoteMapMergerback to summary
public NoteMapMerger(Repository db, NoteMerger noteMerger, MergeStrategy nonNotesMergeStrategy)

Constructs a NoteMapMerger with custom org.eclipse.jgit.notes.NoteMerger and custom org.eclipse.jgit.merge.MergeStrategy.

Parameters
db:Repository

Git repository

noteMerger:NoteMerger

note merger for merging conflicting changes on a note

nonNotesMergeStrategy:MergeStrategy

merge strategy for merging non-note entries

NoteMapMergerback to summary
public NoteMapMerger(Repository db)

Constructs a NoteMapMerger with org.eclipse.jgit.notes.DefaultNoteMerger as the merger for notes and the org.eclipse.jgit.merge.MergeStrategy#RESOLVE as the strategy for resolving conflicts on non-notes

Parameters
db:Repository

Git repository

Method Detail

addIfNotNullback to summary
private void addIfNotNull(FanoutBucket b, int cell, NoteBucket child) throws IOException
addIfNotNullback to summary
private static InMemoryNoteBucket addIfNotNull(InMemoryNoteBucket result, Note note)
asFanoutback to summary
private FanoutBucket asFanout(InMemoryNoteBucket bucket)
equalsback to summary
private static boolean equals(NoteBucket a, NoteBucket b)
getback to summary
private static Note get(LeafBucket b, int i)
mergeback to summary
public NoteMap merge(NoteMap base, NoteMap ours, NoteMap theirs) throws IOException

Performs the merge.

Parameters
base:NoteMap

base version of the note tree

ours:NoteMap

ours version of the note tree

theirs:NoteMap

theirs version of the note tree

Returns:NoteMap

merge result as a new NoteMap

Exceptions
IOException:
if an IO error occurred
mergeback to summary
private InMemoryNoteBucket merge(int treeDepth, InMemoryNoteBucket base, InMemoryNoteBucket ours, InMemoryNoteBucket theirs) throws IOException

This method is called only when it is known that there is some difference between base, ours and theirs.

Parameters
treeDepth:int

depth of the tree

base:InMemoryNoteBucket

base version

ours:InMemoryNoteBucket

ours version

theirs:InMemoryNoteBucket

theirs version

Returns:InMemoryNoteBucket

merge result as an InMemoryBucket

Exceptions
IOException:
if an IO error occurred
mergeFanoutBucketback to summary
private InMemoryNoteBucket mergeFanoutBucket(int treeDepth, FanoutBucket base, FanoutBucket ours, FanoutBucket theirs) throws IOException
mergeLeafBucketback to summary
private InMemoryNoteBucket mergeLeafBucket(int treeDepth, LeafBucket bb, LeafBucket ob, LeafBucket tb) throws MissingObjectException, IOException
mergeNonNotesback to summary
private NonNoteEntry mergeNonNotes(NonNoteEntry baseList, NonNoteEntry oursList, NonNoteEntry theirsList) throws IOException
minback to summary
private static Note min(Note b, Note o, Note t)
nonNotesback to summary
private static NonNoteEntry nonNotes(InMemoryNoteBucket b)
notNullOrEmptyback to summary
private static LeafBucket notNullOrEmpty(LeafBucket b)
sameContentback to summary
private static boolean sameContent(Note a, Note b)
sameNoteback to summary
private static boolean sameNote(Note a, Note b)
sameNoteOrNullback to summary
private static Note sameNoteOrNull(Note min, Note other)
writeback to summary
private ObjectId write(NonNoteEntry list) throws IOException