Package ghidra.app.merge.listing
Class FunctionTagMerger
- java.lang.Object
-
- ghidra.app.merge.listing.FunctionTagMerger
-
- All Implemented Interfaces:
ListingMergeConstants
,MergeResolver
public class FunctionTagMerger extends java.lang.Object implements MergeResolver, ListingMergeConstants
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
Fields Modifier and Type Field Description protected static int
LATEST
protected static int
MY
protected static int
ORIGINAL
protected static int
RESULT
-
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
Constructors Constructor Description FunctionTagMerger(ProgramMultiUserMergeManager mergeManager, Program resultPgm, Program originalPgm, Program latestPgm, Program myPgm, ProgramChangeSet latestChanges, ProgramChangeSet myChanges)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply()
Notification that the apply button was hit.void
cancel()
Notification that the merge process was canceled.java.lang.String
getDescription()
Get the description of what this MergeResolver does.java.lang.String
getName()
PUBLIC METHODSjava.lang.String[][]
getPhases()
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 Detail
-
RESULT
protected static final int RESULT
- See Also:
- Constant Field Values
-
LATEST
protected static final int LATEST
- See Also:
- Constant Field Values
-
MY
protected static final int MY
- See Also:
- Constant Field Values
-
ORIGINAL
protected static final int ORIGINAL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
getName
public java.lang.String getName()
PUBLIC METHODS- Specified by:
getName
in interfaceMergeResolver
-
getDescription
public java.lang.String 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
public void merge(TaskMonitor monitor) throws java.lang.Exception
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:
java.lang.Exception
- if the merge encounters an error and the merge process should not continue.
-
getPhases
public java.lang.String[][] 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
-
-
-