Package ghidra.app.merge.listing
Class FunctionTagMerger
java.lang.Object
ghidra.app.merge.listing.FunctionTagMerger
- All Implemented Interfaces:
ListingMergeConstants,MergeResolver
Class for merging function tag changes. Most tag differences can be easily auto-merged,
which is to say the result will be the set of all of tags from both program 1 and
program 2. Conflicts arise when both parties have edited/deleted the same tag.
The specific cases handled by the class are described below, where:
- X and Y are tags
- X(A) means to take A's version of tag X
- ** indicates a conflict
- NP means the situation is not possible
User A | Add X Add Y Delete X Delete Y Edit X Edit Y
|
User B |
---------------------------------------------------------------------------
Add X | X X,Y NP X NP X,Y(A)
|
Add Y | X,Y Y Y NP X(A),Y NP
|
Delete X | NP Y - - ** Y(A)
|
Delete Y | X NP - - X(A) **
|
Edit X | NP X(B),Y ** X(B) ** X(B),Y(A)
|
Edit Y | X,Y(B) NP Y(B) ** X(A),Y(B) **
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intprotected static final intprotected static final intprotected static final intFields inherited from interface ghidra.app.merge.listing.ListingMergeConstants
ASK_USER, CANCELED, CHECKED_OUT_BUTTON_NAME, CHECKED_OUT_CHECK_BOX_NAME, CHECKED_OUT_LABEL_NAME, CHECKED_OUT_LIST_BUTTON_NAME, INFO_ROW, KEEP_ALL, KEEP_BOTH, KEEP_LATEST, KEEP_MY, KEEP_ORIGINAL, KEEP_RESULT, LATEST_BUTTON_NAME, LATEST_CHECK_BOX_NAME, LATEST_LABEL_NAME, LATEST_LIST_BUTTON_NAME, LATEST_TITLE, MY_TITLE, ORIGINAL_BUTTON_NAME, ORIGINAL_CHECK_BOX_NAME, ORIGINAL_LABEL_NAME, ORIGINAL_TITLE, REMOVE_CHECKED_OUT_BUTTON_NAME, REMOVE_LATEST, REMOVE_LATEST_BUTTON_NAME, REMOVE_MY, RENAME_CHECKED_OUT_BUTTON_NAME, RENAME_LATEST, RENAME_LATEST_BUTTON_NAME, RENAME_MY, RESULT_BUTTON_NAME, RESULT_TITLE, TRUNCATE_LENGTH -
Constructor Summary
ConstructorsConstructorDescriptionFunctionTagMerger(ProgramMultiUserMergeManager mergeManager, Program resultPgm, Program originalPgm, Program latestPgm, Program myPgm, ProgramChangeSet latestChanges, ProgramChangeSet myChanges) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply()Notification that the apply button was hit.voidcancel()Notification that the merge process was canceled.Get the description of what this MergeResolver does.getName()PUBLIC METHODSString[][]Gets identifiers for the merge phases handled by this MergeResolver.voidmerge(TaskMonitor monitor) Perform the merge process.voidsetConflictResolution(int option) For JUnit testing only, set the option for resolving a conflict.
-
Field Details
-
RESULT
protected static final int RESULT- See Also:
-
LATEST
protected static final int LATEST- See Also:
-
MY
protected static final int MY- See Also:
-
ORIGINAL
protected static final int ORIGINAL- See Also:
-
-
Constructor Details
-
FunctionTagMerger
public FunctionTagMerger(ProgramMultiUserMergeManager mergeManager, Program resultPgm, Program originalPgm, Program latestPgm, Program myPgm, ProgramChangeSet latestChanges, ProgramChangeSet myChanges) Constructor.- Parameters:
mergeManager- the merge managerresultPgm- the program storing the result of the mergeoriginalPgm- the state of the program before any changeslatestPgm- the checked in program versionmyPgm- the checked out program versionlatestChanges- tag changes in LatestmyChanges- tag changes in My
-
-
Method Details
-
getName
PUBLIC METHODS- Specified by:
getNamein interfaceMergeResolver
-
getDescription
Description copied from interface:MergeResolverGet the description of what this MergeResolver does.- Specified by:
getDescriptionin interfaceMergeResolver
-
apply
public void apply()Description copied from interface:MergeResolverNotification that the apply button was hit.- Specified by:
applyin interfaceMergeResolver
-
cancel
public void cancel()Description copied from interface:MergeResolverNotification that the merge process was canceled.- Specified by:
cancelin interfaceMergeResolver
-
merge
Description copied from interface:MergeResolverPerform the merge process.- Specified by:
mergein interfaceMergeResolver- Parameters:
monitor- monitor that allows the user to cancel the merge operation- Throws:
Exception- if the merge encounters an error and the merge process should not continue.
-
getPhases
Description copied from interface:MergeResolverGets identifiers for the merge phases handled by this MergeResolver. If the merge has no sub-phases then return an array with a single string array. Each inner String array indicates a path for a single merge phase. Each outer array element represents a phase whose progress we wish to indicate.
Examples:
So for a simple phase which has no sub-phases returnnew String[][] {new String[] {"Phase A"}}
So for a phase with 2 sub-phases returnnew String[][] { new String[] {"Phase A"}, new String[] {"Phase A", "Sub-Phase 1}, new String[] {"Phase A", "Sub-Phase 2} }.- Specified by:
getPhasesin interfaceMergeResolver- Returns:
- an array of phases.
-
setConflictResolution
public void setConflictResolution(int option) For JUnit testing only, set the option for resolving a conflict.- Parameters:
option-
-