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 Repositoryprivate static final FanoutBucketprivate static final LeafBucketprivate final ObjectInserterprivate final MergeStrategyprivate final NoteMergerprivate final MutableObjectIdprivate final ObjectReader -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a NoteMapMerger withDefaultNoteMergeras the merger for notes and theMergeStrategy.RESOLVEas the strategy for resolving conflicts on non-notesNoteMapMerger(Repository db, NoteMerger noteMerger, MergeStrategy nonNotesMergeStrategy) Constructs a NoteMapMerger with customNoteMergerand customMergeStrategy. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddIfNotNull(FanoutBucket b, int cell, NoteBucket child) private static InMemoryNoteBucketaddIfNotNull(InMemoryNoteBucket result, Note note) private FanoutBucketasFanout(InMemoryNoteBucket bucket) private static booleanequals(NoteBucket a, NoteBucket b) private static Noteget(LeafBucket b, int i) private InMemoryNoteBucketmerge(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 InMemoryNoteBucketmergeFanoutBucket(int treeDepth, FanoutBucket base, FanoutBucket ours, FanoutBucket theirs) private InMemoryNoteBucketmergeLeafBucket(int treeDepth, LeafBucket bb, LeafBucket ob, LeafBucket tb) private NonNoteEntrymergeNonNotes(NonNoteEntry baseList, NonNoteEntry oursList, NonNoteEntry theirsList) private static Noteprivate static NonNoteEntryprivate static LeafBucketprivate static booleansameContent(Note a, Note b) private static booleanprivate static NotesameNoteOrNull(Note min, Note other) private ObjectIdwrite(NonNoteEntry list)
-
Field Details
-
EMPTY_FANOUT
-
EMPTY_LEAF
-
db
-
noteMerger
-
nonNotesMergeStrategy
-
reader
-
inserter
-
objectIdPrefix
-
-
Constructor Details
-
NoteMapMerger
Constructs a NoteMapMerger with customNoteMergerand 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 withDefaultNoteMergeras the merger for notes and theMergeStrategy.RESOLVEas 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:
MissingObjectExceptionIOException
-
notNullOrEmpty
-
get
-
min
-
sameNoteOrNull
-
sameNote
-
sameContent
-
addIfNotNull
-
mergeNonNotes
private NonNoteEntry mergeNonNotes(NonNoteEntry baseList, NonNoteEntry oursList, NonNoteEntry theirsList) throws IOException - Throws:
IOException
-
write
- Throws:
IOException
-