Package org.eclipse.jgit.notes
Class NoteMapMerger
java.lang.Object
org.eclipse.jgit.notes.NoteMapMerger
Three-way note tree merge.
Direct implementation of NoteMap merger without using
TreeWalk
and
AbstractTreeIterator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate 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
ConstructorsConstructorDescriptionConstructs a NoteMapMerger withDefaultNoteMerger
as the merger for notes and theMergeStrategy.RESOLVE
as the strategy for resolving conflicts on non-notesNoteMapMerger
(Repository db, NoteMerger noteMerger, MergeStrategy nonNotesMergeStrategy) Constructs a NoteMapMerger with customNoteMerger
and customMergeStrategy
. -
Method Summary
Modifier and TypeMethodDescriptionprivate 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.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
private static NonNoteEntry
private static LeafBucket
private static boolean
sameContent
(Note a, Note b) private static boolean
private static Note
sameNoteOrNull
(Note min, Note other) private ObjectId
write
(NonNoteEntry list)
-
Field Details
-
EMPTY_FANOUT
-
EMPTY_LEAF
-
db
-
noteMerger
-
nonNotesMergeStrategy
-
reader
-
inserter
-
objectIdPrefix
-
-
Constructor Details
-
NoteMapMerger
Constructs a NoteMapMerger with customNoteMerger
and customMergeStrategy
.- Parameters:
db
- Git repositorynoteMerger
- note merger for merging conflicting changes on a notenonNotesMergeStrategy
- merge strategy for merging non-note entries
-
NoteMapMerger
Constructs a NoteMapMerger withDefaultNoteMerger
as the merger for notes and theMergeStrategy.RESOLVE
as the strategy for resolving conflicts on non-notes- Parameters:
db
- Git repository
-
-
Method Details
-
merge
Performs the merge.- Parameters:
base
- base version of the note treeours
- ours version of the note treetheirs
- theirs version of the note tree- Returns:
- merge result as a new NoteMap
- Throws:
IOException
-
merge
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
-base
-ours
-theirs
-- Returns:
- merge result as an InMemoryBucket
- Throws:
IOException
-
asFanout
-
nonNotes
-
mergeFanoutBucket
private InMemoryNoteBucket mergeFanoutBucket(int treeDepth, FanoutBucket base, FanoutBucket ours, FanoutBucket theirs) throws IOException - Throws:
IOException
-
equals
-
addIfNotNull
- Throws:
IOException
-
mergeLeafBucket
private InMemoryNoteBucket mergeLeafBucket(int treeDepth, LeafBucket bb, LeafBucket ob, LeafBucket tb) throws MissingObjectException, IOException - Throws:
MissingObjectException
IOException
-
notNullOrEmpty
-
get
-
min
-
sameNoteOrNull
-
sameNote
-
sameContent
-
addIfNotNull
-
mergeNonNotes
private NonNoteEntry mergeNonNotes(NonNoteEntry baseList, NonNoteEntry oursList, NonNoteEntry theirsList) throws IOException - Throws:
IOException
-
write
- Throws:
IOException
-