Command line tools

This guide explains how to use the command-line utilities provided by Model RealTime to perform compare and merge operations on model files. These tools enable launching both non-visual and visual compare/merge sessions, suitable for manual use or automation.

Model RealTime utilizes two separate command-line utilities, XtoolsTypeManager and cmcmdline.jar, that enable users to launch compare and merge sessions for model files directly from the command line or within automated scripts.



XtoolsTypeManager

The XtoolsTypeManager command-line tool is a specialized utility designed primarily for integration with the ClearCase Configuration Management (CM) system. This tool ensures that when a ClearCase command, such as cleartool diff, is executed on a Model RealTime model file, the appropriate Model RealTime graphical compare session is launched, superseding the default text-based difference tool.

Note: While it is possible to invoke XtoolsTypeManager for general command-line Compare/Merge tasks, this approach is not recommended due to its specific design focus on the ClearCase environment.

This is an executable on Windows, and a shell-script on Linux. It’s located in the plugin folder for the com.ibm.xtools.comparemerge.team plugin. For example:

```
<install-dir>\plugins\com.ibm.xtools.comparemerge.team_7.60.100.v20150603_0908\utm
```

One way to find out the exact path to XtoolsTypeManager, which for example a script can use, is to look in the file TypeManagerLaunchCommand.cfg which is located in the user's home directory under AppData/Roaming/Rational/TeamServerSharedData (on Windows) and rational/TeamServerSharedData/linux_x86 (on Linux). The path to XtoolsTypeManager is specified in this file.

cmcmdline.jar

The cmcmdline.jar is a Java application that serves as the strategic command-line utility for Model RealTime or Rational Software Architect Designer's Compare/Merge functionality. It is designed to be a generic, feature-rich, and modern alternative. It is the recommended tool for all general-purpose command-line Compare/Merge operations, offering greater versatility and a richer feature set.

This tool is the standard utility for integrating Model RealTime with other Configuration Management systems (CMs), such as Git, Subversion, or similar tools. Since these CM systems typically lack a pre-configured integration, the user must manually configure the process. This involves writing a wrapper script that accepts the arguments provided by the CM system and correctly uses them to invoke the cmcmdline.jar application.

The full path to cmcmdline.jar can be seen in the preferences at General – Compare/Patch – Modeling Compare/Merge – Compare/Merge Server.

Available commands for cmcmdline.jar

Launch the command-line tool using Java like this:

java -cp cmcmdline.jar com.ibm.xtools.comparemerge.cmcmdline.CMTool <command> <options>

You should use the same Java virtual machine that you use for running Model RealTime (normally specified in eclipse.ini using the -vm argument).

<command> is one of the following:

Available options for cmcmdline.jar

You must also specify <options> according to which command that is used. The following options are available (use the -help option to list all available options):

-autoLaunch "C:\rtist\eclipse\eclipse.exe -nosplash -data C:\rtist\egit_workspace -showlocation" 

Command-line usage examples

This section presents practical examples demonstrating how to use the cmcmdline.jar tool to perform compare and merge operations, along with expected outputs.

Non-visual compare (diff)

Command:

D:\tmp\cm_api_automatic_tests>C:\java-install\jdk\jre\bin\java.exe -cp C:\eclipse\plugins\com.ibm.xtools.comparemerge.team_7.60.100.v20180706_1406\utm\cmcmdline.jar com.ibm.xtools.comparemerge.cmcmdline.CMTool compare -ancestor=models/conflicting/CPPModel.emx -left=models/conflicting/CPPModel-v1.emx -right models/conflicting/CPPModel-v2.emx

Output:

PATH : Converted path in -ancestor=models/conflicting/CPPModel.emx to D:\tmp\cm_api_automatic_tests\models\conflicting\CPPModel.emx
PATH : Converted path in -left=models/conflicting/CPPModel-v1.emx to D:\tmp\cm_api_automatic_tests\models\conflicting\CPPModel-v1.emx
PATH : Converted path in -right=models/conflicting/CPPModel-v2.emx to D:\tmp\cm_api_automatic_tests\models\conflicting\CPPModel-v2.emx

CONNECT : Connecting to TeamServer...
CONNECT : Connected to TeamServer at port 60002. Protocol: 9.2

Non-Visual Compare completed with result : SUCCESS.DIFF
conflicts : 2
left diffs : 2
right diffs : 1

Non-visual compare (match)

Command:

D:\tmp\cm_api_automatic_tests>C:\java-install\jdk\jre\bin\java.exe -cp C:\eclipse\plugins\com.ibm.xtools.comparemerge.team_7.60.100.v20180706_1406\utm\cmcmdline.jar com.ibm.xtools.comparemerge.cmcmdline.CMTool compare -ancestor=models/conflicting/CPPModel.emx -left=models/conflicting/CPPModel.emx -right=models/conflicting/CPPModel.emx

Output:

PATH : Converted path in -ancestor=models/conflicting/CPPModel.emx to D:\tmp\cm_api_automatic_tests\models\conflicting\CPPModel.emx
PATH : Converted path in -left=models/conflicting/CPPModel.emx to D:\tmp\cm_api_automatic_tests\models\conflicting\CPPModel.emx
PATH : Converted path in -right=models/conflicting/CPPModel.emx to D:\tmp\cm_api_automatic_tests\models\conflicting\CPPModel.emx

CONNECT : Connecting to TeamServer...
CONNECT : Connected to TeamServer at port 60002. Protocol: 9.2

Non-Visual Compare completed with result : SUCCESS.MATCH
conflicts : 0
left diffs : 0
right diffs : 0

Non-Visual merge

Command:

D:\tmp\cm_api_automatic_tests>C:\java-install\jdk\jre\bin\java.exe -cp C:\eclipse\plugins\com.ibm.xtools.comparemerge.team_7.60.100.v20180706_1406\utm\cmcmdline.jar com.ibm.xtools.comparemerge.cmcmdline.CMTool merge -ancestor=models/non_conflicting/CPPModel.emx -left=models/non_conflicting/CPPModel-v1.emx -right models/non_conflicting/CPPModel-v2.emx -out run/merged.emx

Output:

PATH : Converted path in -ancestor=models/non_conflicting/CPPModel.emx to D:\tmp\cm_api_automatic_tests\models\non_conflicting\CPPModel.emx
PATH : Converted path in -left=models/non_conflicting/CPPModel-v1.emx to D:\tmp\cm_api_automatic_tests\models\non_conflicting\CPPModel-v1.emx
PATH : Converted path in -right=models/non_conflicting/CPPModel-v2.emx to D:\tmp\cm_api_automatic_tests\models\non_conflicting\CPPModel-v2.emx

CONNECT : Connecting to TeamServer...
CONNECT : Connected to TeamServer at port 60002. Protocol: 9.2

Non-Visual Merge completed with result : SUCCESS

Visual merge

Command:

D:\tmp\cm_api_automatic_tests>C:\java-install\jdk\jre\bin\java.exe -cp C:\eclipse\plugins\com.ibm.xtools.comparemerge.team_7.60.100.v20180706_1406\utm\cmcmdline.jar com.ibm.xtools.comparemerge.cmcmdline.CMTool xmerge -ancestor=models/conflicting/CPPModel.emx -left=models/conflicting/CPPModel-v1.emx -right models/conflicting/CPPModel-v2.emx -out run/merged.emx

Output:

PATH : Converted path in -ancestor=models/conflicting/CPPModel.emx to D:\tmp\cm_api_automatic_tests\models\conflicting\CPPModel.emx
PATH : Converted path in -left=models/conflicting/CPPModel-v1.emx to D:\tmp\cm_api_automatic_tests\models\conflicting\CPPModel-v1.emx
PATH : Converted path in -right=models/conflicting/CPPModel-v2.emx to D:\tmp\cm_api_automatic_tests\models\conflicting\CPPModel-v2.emx

CONNECT : Connecting to TeamServer...
CONNECT : Connected to TeamServer at port 60002. Protocol: 9.2

Visual Merge completed with result : SUCCESS

Failed non-visual merge (due to unresolved conflicts)

Command:

D:\tmp\cm_api_automatic_tests>C:\java-install\jdk\jre\bin\java.exe -cp C:\eclipse\plugins\com.ibm.xtools.comparemerge.team_7.60.100.v20180706_1406\utm\cmcmdline.jar com.ibm.xtools.comparemerge.cmcmdline.CMTool merge -ancestor=models/conflicting/CPPModel.emx -left=models/conflicting/CPPModel-v1.emx -right models/conflicting/CPPModel-v2.emx -out run/merged.emx

Output:

PATH : Converted path in -ancestor=models/conflicting/CPPModel.emx to D:\tmp\cm_api_automatic_tests\models\conflicting\CPPModel.emx
PATH : Converted path in -left=models/conflicting/CPPModel-v1.emx to D:\tmp\cm_api_automatic_tests\models\conflicting\CPPModel-v1.emx
PATH : Converted path in -right=models/conflicting/CPPModel-v2.emx to D:\tmp\cm_api_automatic_tests\models\conflicting\CPPModel-v2.emx

CONNECT : Connecting to TeamServer...
CONNECT : Connected to TeamServer at port 60002. Protocol: 9.2

Non-visual Merge completed with result : FAILED.Unresolved Conflicts