Package ghidra.app.merge.listing

# Class FunctionTagMerger

java.lang.Object
ghidra.app.merge.listing.FunctionTagMerger

All Implemented Interfaces:
  `ListingMergeConstants`, `MergeResolver`

public class FunctionTagMerger extends 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 final int`
  `LATEST`
  `protected static final int`
  `MY`
  `protected static final int`
  `ORIGINAL`
  `protected static final 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

  Modifier and Type
  Method
  Description
  `void`
  `apply()`
  Notification that the apply button was hit.
  `void`
  `cancel()`
  Notification that the merge process was canceled.
  `String`
  `getDescription()`
  Get the description of what this MergeResolver does.
  `String`
  `getName()`
  PUBLIC METHODS
  `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.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### 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 Details

  - ### FunctionTagMerger

    public FunctionTagMerger(ProgramMultiUserMergeManager mergeManager, Program resultPgm, Program originalPgm, Program latestPgm, Program myPgm, ProgramChangeSet latestChanges, ProgramChangeSet myChanges)
    Constructor.
    Parameters:
      `mergeManager` - the merge manager
      `resultPgm` - the program storing the result of the merge
      `originalPgm` - the state of the program before any changes
      `latestPgm` - the checked in program version
      `myPgm` - the checked out program version
      `latestChanges` - tag changes in Latest
      `myChanges` - tag changes in My

- ## Method Details

  - ### getName

    public String getName()
    PUBLIC METHODS
    Specified by:
      `getName` in interface `MergeResolver`

  - ### getDescription

    public String getDescription()
    Description copied from interface: `MergeResolver`
    Get the description of what this MergeResolver does.
    Specified by:
      `getDescription` in interface `MergeResolver`

  - ### apply

    public void apply()
    Description copied from interface: `MergeResolver`
    Notification that the apply button was hit.
    Specified by:
      `apply` in interface `MergeResolver`

  - ### cancel

    public void cancel()
    Description copied from interface: `MergeResolver`
    Notification that the merge process was canceled.
    Specified by:
      `cancel` in interface `MergeResolver`

  - ### merge

    public void merge(TaskMonitor monitor) throws Exception
    Description copied from interface: `MergeResolver`
    Perform the merge process.
    Specified by:
      `merge` in interface `MergeResolver`
    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

    public 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 return `new String[][] {new String[] {"Phase A"}}`
    So for a phase with 2 sub-phases return `new String[][] { new String[] {"Phase A"}, new String[] {"Phase A", "Sub-Phase 1}, new String[] {"Phase A", "Sub-Phase 2} }` .
    Specified by:
      `getPhases` in interface `MergeResolver`
    Returns:
      an array of phases.

  - ### setConflictResolution

    public void setConflictResolution(int option)
    For JUnit testing only, set the option for resolving a conflict.
    Parameters:
      `option` -