public class NoteMapMerger
extends java.lang.Object
Direct implementation of NoteMap merger without using
TreeWalk
and
AbstractTreeIterator
Modifier and Type | Field and Description |
---|---|
private Repository |
db |
private static FanoutBucket |
EMPTY_FANOUT |
private static LeafBucket |
EMPTY_LEAF |
private ObjectInserter |
inserter |
private MergeStrategy |
nonNotesMergeStrategy |
private NoteMerger |
noteMerger |
private MutableObjectId |
objectIdPrefix |
private ObjectReader |
reader |
Constructor and Description |
---|
NoteMapMerger(Repository db)
Constructs a NoteMapMerger with
DefaultNoteMerger as the merger for notes
and the MergeStrategy.RESOLVE as the
strategy for resolving conflicts on non-notes |
NoteMapMerger(Repository db,
NoteMerger noteMerger,
MergeStrategy nonNotesMergeStrategy)
Constructs a NoteMapMerger with custom
NoteMerger and custom
MergeStrategy . |
Modifier and Type | Method and Description |
---|---|
private void |
addIfNotNull(FanoutBucket b,
int cell,
NoteBucket child) |
private static InMemoryNoteBucket |
addIfNotNull(InMemoryNoteBucket result,
Note note) |
private FanoutBucket |
asFanout(InMemoryNoteBucket bucket) |
private static boolean |
equals(NoteBucket a,
NoteBucket b) |
private static Note |
get(LeafBucket b,
int i) |
private InMemoryNoteBucket |
merge(int treeDepth,
InMemoryNoteBucket base,
InMemoryNoteBucket ours,
InMemoryNoteBucket theirs)
This method is called only when it is known that there is some difference
between base, ours and theirs.
|
NoteMap |
merge(NoteMap base,
NoteMap ours,
NoteMap theirs)
Performs the merge.
|
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 |
nonNotes(InMemoryNoteBucket b) |
private static LeafBucket |
notNullOrEmpty(LeafBucket b) |
private static boolean |
sameContent(Note a,
Note b) |
private static boolean |
sameNote(Note a,
Note b) |
private static Note |
sameNoteOrNull(Note min,
Note other) |
private ObjectId |
write(NonNoteEntry list) |
private static final FanoutBucket EMPTY_FANOUT
private static final LeafBucket EMPTY_LEAF
private final Repository db
private final NoteMerger noteMerger
private final MergeStrategy nonNotesMergeStrategy
private final ObjectReader reader
private final ObjectInserter inserter
private final MutableObjectId objectIdPrefix
public NoteMapMerger(Repository db, NoteMerger noteMerger, MergeStrategy nonNotesMergeStrategy)
NoteMerger
and custom
MergeStrategy
.db
- Git repositorynoteMerger
- note merger for merging conflicting changes on a notenonNotesMergeStrategy
- merge strategy for merging non-note entriespublic NoteMapMerger(Repository db)
DefaultNoteMerger
as the merger for notes
and the MergeStrategy.RESOLVE
as the
strategy for resolving conflicts on non-notesdb
- Git repositorypublic NoteMap merge(NoteMap base, NoteMap ours, NoteMap theirs) throws java.io.IOException
base
- base version of the note treeours
- ours version of the note treetheirs
- theirs version of the note treejava.io.IOException
private InMemoryNoteBucket merge(int treeDepth, InMemoryNoteBucket base, InMemoryNoteBucket ours, InMemoryNoteBucket theirs) throws java.io.IOException
treeDepth
- base
- ours
- theirs
- java.io.IOException
private FanoutBucket asFanout(InMemoryNoteBucket bucket)
private static NonNoteEntry nonNotes(InMemoryNoteBucket b)
private InMemoryNoteBucket mergeFanoutBucket(int treeDepth, FanoutBucket base, FanoutBucket ours, FanoutBucket theirs) throws java.io.IOException
java.io.IOException
private static boolean equals(NoteBucket a, NoteBucket b)
private void addIfNotNull(FanoutBucket b, int cell, NoteBucket child) throws java.io.IOException
java.io.IOException
private InMemoryNoteBucket mergeLeafBucket(int treeDepth, LeafBucket bb, LeafBucket ob, LeafBucket tb) throws MissingObjectException, java.io.IOException
MissingObjectException
java.io.IOException
private static LeafBucket notNullOrEmpty(LeafBucket b)
private static Note get(LeafBucket b, int i)
private static InMemoryNoteBucket addIfNotNull(InMemoryNoteBucket result, Note note)
private NonNoteEntry mergeNonNotes(NonNoteEntry baseList, NonNoteEntry oursList, NonNoteEntry theirsList) throws java.io.IOException
java.io.IOException
private ObjectId write(NonNoteEntry list) throws java.io.IOException
java.io.IOException