Unified Plastic SCM Branch diff
You can extend the actions available for branches (and many other objects) by using the external tools feature.
This blogpost explains how to create a custom action to run a unified diff operation for a Plastic SCM branch.
How does it work?
Adding new custom tools to the Plastic SCM GUI is easy.
As we explain here, you need to add a new line to the
externaltools.conf configuration file:
branch | Create unified diff for THIS branch | C:\tools\unifiedbranchdiff.exe | @wkpath "@object" "C:\Program Files (x86)\Notepad++\notepad++.exe"
with the following structure:
- The object you want to target, in this case branch.
- The title you want to display at the context menu, Create unified diff for THIS branch.
- The tool you want to execute when the action is clicked, C:\tools\unifiedbranchdiff.exe.
- The arguments to the tool. We use the @wkpath and @object that are provided by the Plastic GUI, then the editor tool we want to use to display the unified diff content.
This is a custom action for the Plastic SCM branches, so, you will find it in the branch object context menu:
This action, configured as an "External tool", opens the unified diff for all the changes made on that branch using your favorite editor:
With the unified branch diff in your favorite editor, you are free to review and save it for later use as a report.
This simple tool does two small things:
- It uses the cm path command to get a unified diff for the @object parameter.
- It runs the configured editor with the result of the cm path command.
You can review the source code. Find the download link at the beginning of this blogpost.
The cm patch command generates a patch file from a spec or applies a generated patch to the current workspace. It creates a patch file that contains the differences in a branch, a changeset, or the differences between changesets. It will track both the differences of text and binary files.
The --apply parameter allows you to apply the contents of a generated patch file to the current workspace.
This command requires Diff (http://gnuwin32.sourceforge.net/packages/diffutils.htm) and Patch (http://gnuwin32.sourceforge.net/packages/patch.htm) tools.
Once installed, we recommend that you add their location to the
PATH environment variable.
You can also specify the application to use (diff or patch) using the cm patch --tool parameter.