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
Modifier and TypeFieldDescriptionprotected static final int
protected static final int
protected static final int
protected static final int
Fields 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
ConstructorDescriptionFunctionTagMerger
(ProgramMultiUserMergeManager mergeManager, Program resultPgm, Program originalPgm, Program latestPgm, Program myPgm, ProgramChangeSet latestChanges, ProgramChangeSet myChanges) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
apply()
Notification that the apply button was hit.void
cancel()
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.void
merge
(TaskMonitor monitor) Perform the merge process.void
setConflictResolution
(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:
getName
in interfaceMergeResolver
-
getDescription
Description copied from interface:MergeResolver
Get the description of what this MergeResolver does.- Specified by:
getDescription
in interfaceMergeResolver
-
apply
public void apply()Description copied from interface:MergeResolver
Notification that the apply button was hit.- Specified by:
apply
in interfaceMergeResolver
-
cancel
public void cancel()Description copied from interface:MergeResolver
Notification that the merge process was canceled.- Specified by:
cancel
in interfaceMergeResolver
-
merge
Description copied from interface:MergeResolver
Perform the merge process.- Specified by:
merge
in 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:MergeResolver
Gets 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:
getPhases
in 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
-
-