Who we are

We are the developers of Plastic SCM, a full version control stack (not a Git variant). We work on the strongest branching and merging you can find, and a core that doesn't cringe with huge binaries and repos. We also develop the GUIs, mergetools and everything needed to give you the full version control stack.

If you want to give it a try, download it from here.

We also code SemanticMerge, and the gmaster Git client.

Unified diff of a branch

Wednesday, November 14, 2018 Ma Nu 0 Comments

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

Unified diff

This blogpost explains how to create a custom action to run a unified diff operation for a Plastic SCM branch.

Get the external tool from here. And browse the source code here.

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:

Action - Context menu

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:

  1. It uses the cm path command to get a unified diff for the @object parameter.
  2. 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.

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 (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.

Manuel Lucio
I'm in charge of the Customer Support area.
I deal with complex setups, policies and working methodologies on a daily basis.
Prior to taking full responsibility of support, I worked as software engineer. I have been in charge of load testing for quite some time, so if you want to know how well Plastic compares to SVN or P4 under a really heavy load, I'm your guy.
I like to play with Arduino GPS devices, mountain biking and playing tennis.
You can find me hooked to my iPhone, skate-boarding or learning Korean... and also here @mrcatacroquer.

0 comentarios: