/unified-branch-diff

A small tool to create a unified branch diff

Primary LanguageC#MIT LicenseMIT

Unified Plastic SCM Branch diff

You can extend the actions available for branches (and many other objects) by using the external tools feature.

This requires Plastic SCM client version to be 7.0.16.2032 or higher.

See it in action

This document 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:

  1. The object you want to target, in this case branch.
  2. The title you want to display at the context menu, Create unified diff for THIS branch.
  3. The tool you want to execute when the action is clicked, C:\tools\unifiedbranchdiff.exe.
  4. 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:

Action - 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:

Unified diff in text editor

With the unified branch diff in your favorite editor, you are free to review and save it for later use as a report.

UnifiedBranchDiff tool

This simple tool does two small things:

  • It uses the cm patch command to get a unified diff for the @object parameter.
  • It runs the configured editor with the result of the cm path command.

cm patch

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 and Patch 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.