# Comparing and Merging Configurations

## Contents
Overview Compare and Merge Example Viewing Differences Swapping the Source and Target Filtering Differences Selecting Differences for Merging

## Overview
In the Policy Studio, the Profile Repository tab enables administrators to compare different configuration Profiles and merge differences between them. You can select Window -> Show View -> Profile Repository from the main menu. On the Profile Repository tab, when you select two Configuration Profiles, two Configuration Profile Versions, or one Configuration Profile and one Version in the tree or table, the Compare menu option is available. This option loads the selected Configuration Profiles into the Profile Editor tab below, and compares them in the Compare and Merge tab on the right.
## Compare and Merge Example
The Compare and Merge tab is best illustrated with an example. The following screen shot shows the Compare and Merge tab:
Compare and Merge Tab
This simple example compares two configurations. The configuration at the top left of the screen is the Merge from Configuration (Source). The configuration on the right is the Merge into Configuration (Target). Any merged changes are applied from the source configuration on the left into the target configuration on the right. By default, all differences between both configurations are displayed in the tree (Additions, Deletions, and Conflicts). However, only Additions are selected by default for merging. You must explicitly select Deletions and Conflicts in the tree for merging.
## Viewing Differences
In the following screen shot, the `Monitoring Configuration` node has a Conflict (exists in both configurations but is not the same). If you select that node in the Differences tree, the Differences Details panel at the bottom of the screen shows the details for this configuration entity, and highlights the changed fields.
Compare and Merge Differences
For example, the `messageMonitoringEnabled` field value differs between both configurations. When you perform a Merge, the value of this field in the Merge into Configuration (Target) is updated to that in the Merge from Configuration (Source). If a difference is marked as an Addition, this means that it exists in the source configuration, but not in the target configuration. When you perform a Merge, you add the entities into the target configuration. If a difference is marked as a Deletion, this means that it exists in the target configuration, but not in the source configuration. When you perform a Merge, you delete the entities from the target configuration. In this example, the generated filter circuits for the `HelloWorldService` would be deleted in a merge. Some configuration entities contain references to other entities. In this case, an icon is displayed for the field in the Difference Details panel. If you double-click a row with an icon, you can drill down to view further Difference Details dialogs for those entities.
## Swapping the Source and Target
You can swap the source and target configurations by clicking the Swap button. When this button is clicked, Additions become Deletions, and Deletions become Additions in the Differences tree. To refresh the Differences tree, click the Compare button. If modifications are made in the Profile Editor tab after the Compare and Merge tab is opened, a refresh of the comparison is required to show new differences.
## Filtering Differences
To filter nodes from the Differences tree view based on their type, right-click in the tree, and select from the following View Nodes options:
Additions | Exist in the source configuration being imported but not in the destination configuration. Displayed as a green plus icon.
Deletions | Exist in the destination configuration but not in the source configuration being imported. Displayed as a red minus icon.
Conflicts | Exist in both configurations but are not the same. Displayed as a yellow warning icon.
External Connection Conflicts | External Connections that exist in both configurations but are not the same. Displayed as a yellow warning icon.
Identical | Exist in both configurations and are exactly the same. Displayed as grayed out nodes.
By default, all differences are displayed, and identical nodes are not displayed.
## Selecting Differences for Merging
You can merge all differences in the tree, or a subset of differences by right-clicking, and selecting the Select Nodes for Merging options: Additions Deletions Conflicts External Connection Conflicts By default, only Additions are automatically selected for merging. Alternatively, you can manually select the check boxes on the tree nodes. When you click the Merge button, only the tree items that are selected are merged into the configuration on the right. You must also take care to merge any entities that are referred to. The Difference Counts field shows the number of entities that are classed as Additions, Deletions, and Conflicts. If all differences are merged, these counts are reset to zero. If there are no differences between both configurations, the tree is empty and the Difference Counts is set to zero.