This Polarion extension provides functionality of diffing:
...and then to merge selected diffs from left to right document. First 2 options are available either via selecting 2 certain documents
or via a collection of documents.
In case of diffing work items, appropriate counterpart work items (from another document or another project) are always seeking
by selected link role.
Additionally, the extension provides functionality to make a copy of selected document in other location.
Important
Starting from version 5.0.0 only latest version of Polarion is supported.
Right now it is Polarion 2512.
The latest version of the extension can be downloaded from the releases page and installed to Polarion instance without necessity to be compiled from the sources.
The extension should be copied to <polarion_home>/polarion/extensions/ch.sbb.polarion.extension.diff-tool/eclipse/plugins and changes will take effect after Polarion restart.
Important
Don't forget to clear <polarion_home>/data/workspace/.config folder after extension installation/update to make it work properly.
This extension is compatible with:
sections-element:
…
<sections>
<section id="fields"/>
…
</sections>
……
<extension id="diff-tool" label="Documents Comparison" />
…Repeat the instructions above except that on the step 5 use the following line:
…
<extension id="copy-tool" label="Documents Copy" />
…topics-element:
…
<topic id="diff-tool"/>
…The Diff Tool UI makes numerous requests to Polarion using the REST API to retrieve information about documents and their workitems. These requests can be processed in parallel to improve performance.
The number of parallel requests can be configured in polarion.properties file:
ch.sbb.polarion.extension.diff-tool.chunk.size=2Default value is 2. Increasing this value may speed up the process but can also overload your Polarion server.
Diff Tool. There are 2 sub-menus with different configuration options for Diff Tool.Quick Help section with short description or their content is self-evident.Save button.Compare.Create Document.This extension provides REST API. OpenAPI Specification can be obtained here.
diffText and diffHtml functions are available in Velocity context referenced by $diffTool variable.
Example:
$diffTool.diffText("Some text", "Some another text").getResult()or
$diffTool.diffHtml("<html><body><div>Some text</div></body></html>", "<html><body><div>Some another text</div></body></html>").getResult()Also, isDifferent can be used if you need to show something specific for cases when the values are the same:
#set($diffResult = $diffTool.diffText("Some text", "Some text"))
#if($diffResult.isDifferent())
$diffResult.getResult()
#else
No changes
#enddiffWorkItems compares two work items and returns a WorkItemsPairDiff object containing all differences.
| Parameter | Type | Required | Description |
|---|---|---|---|
leftProjectId |
String |
Yes | The project ID of the left (reference) work item for comparison context |
leftWorkItem |
IWorkItem |
No | The first work item to compare (left side). Can be null. |
rightWorkItem |
IWorkItem |
No | The second work item to compare (right side). Can be null. |
configName |
String |
Yes | The name of the diff configuration to use (e.g., "Default"). Determines which fields are compared and how differences are calculated. |
linkRole |
String |
No | The role/type of link between paired work items (e.g., "parent", "relates_to"). Can be null if no link relationship needs to be considered. |
WorkItemsPairDiff - An object containing all field-level differences between the work items, accessible via fieldDiffsMap where each entry contains the field name and diff values.
## Get current project object
#set($projectId = $page.fields().project().projectId())
#set($project = $projectService.getProject($projectId))
<h2>Selected Work Items in Project: $project.name</h2>
## Example: Specific IDs in this project
#set($query = "project.id:$projectId AND (id:EL-1 OR id:EL-2)")
#set($workItems = $trackerService.queryWorkItems($query, "id"))
#set($rightWorkItem = $workItems.get(0))
#set($rightWorkItem = $workItems.get(1))
#set($diffResult = $diffTool.diffWorkItems($projectId, $rightWorkItem, $rightWorkItem, "Default", ""))
<h3>Work Item Differences</h3>
<table border="1" cellspacing="0" cellpadding="5">
<tr>
<th>Field</th>
<th>$rightWorkItem.id</th>
<th>$rightWorkItem.id</th>
</tr>
## Loop through all field differences
#foreach($fieldId in $diffResult.fieldDiffsMap.keySet())
#set($fieldDiff = $diffResult.fieldDiffsMap.get($fieldId))
<tr>
<td>$fieldDiff.getName()</td>
<td>$fieldDiff.getDiffLeft()</td>
<td>$fieldDiff.getDiffRight()</td>
</tr>
#end
</table>