Merging files or directories

Each type of object for which you can merge source has default merge tools predefined by Rational® Synergy for both the CLI and the GUI. The default merge tool for the GUI is interactive, and the one for the CLI is automatic. The merge tool creates a new, controlled version of your file. If the merge is successful, the merge results are written to the new file.

When merging directories, the merge tool automatically accounts for both additions to and deletions from both directories in a new, controlled, merged directory.

If an object to be merged is a member of your project, Rational Synergy uses the new merged object in the project.

An area "in conflict" occurs when both versions have changes in the same place relative to the common ancestor. If your merged file contains any conflicts, the tool marks the conflicts so you can find them quickly and easily. The tool then writes the merge results to the new file.

The following example shows how the merged file is marked:

<<<<<<<file1 filename1
conflicting lines in file1
=======
conflicting lines in file2
>>>>>>>file2 filename2

The default merge tool is specified in the ccm.properties file for UNIX and Windows. You can specify a different merge tool for each object type. The specified merge tool applies to the specified type and any subtype without a specified merge tool. By default, only the ASCII file type has a merge tool defined.

Additionally, you can set encoding rules in the ccm.properties file so that merged files display in the correct encoding, as follows:

// Command to perform merge of source objects on UNIX and its checkstatus.
ccm.cli.tools.merge.ascii.unix=%ccm_home/bin/util/cc_merge %ccm_home %{encoding[null='CP1252']} %outfile %file1 %ancestor %file2^M
// Command to perform merge of source objects on Windows and its checkstatus.
ccm.cli.tools.merge.ascii.windows="%ccm_home\\\\bin\\\\util\\\\cc_merge.bat" "%ccm_home" %{encoding[null='CP1252']} %outfile %file1 %ancestor %file2

The second parameter to the ccm_merge command allows you to specify an encoding for the file being merged. The syntax “%{encoding[null='CP1252']}” is interpreted as follows:

If the object type specifies a work area encoding with the encoding_rules attribute, use that encoding for the merge. If not, use the CP1252 encoding. (See File encodings for a discussion of the encoding_rules attribute.)

You can specify a default encoding other than CP1252 for this parameter. For example, the following syntax indicates to use the UTF8 encoding if an encoding is not specified on the object type:

ccm.cli.tools.merge.ascii.windows="%ccm_home\\\\bin\\\\util\\\\cc_merge.bat" "%ccm_home" %{encoding[null='UTF8']} %outfile %file1 %ancestor %file2

The following syntax indicates to always use the CP1252 encoding:

ccm.cli.tools.merge.ascii.windows="%ccm_home\\\\bin\\\\util\\\\cc_merge.bat" "%ccm_home" CP1252 %outfile %file1 %ancestor %file2

The valid encodings are CP1252, UTF8, BIG5, eucJP, EUC-KR, SJIS, and GB18030.

The files being merged and the ancestor file must have the same encoding.

For example, in a Chinese-language database, you might set the following encoding rules for the ascii type:

Server-encoding: GB18030
Unix-wa-encoding: GB18030
Windows-wa-encoding: GB18030

Assuming the default encoding parameters for the ccm_merge command were used, the CLI and GUI merge tools are then invoked with the GB18030 encoding.

Alternatively, if your site contains only Chinese-language databases, you can change the default merge command as follows, and encoding_rules attributes are not required on the ascii type.

ccm.cli.tools.merge.ascii.windows="%ccm_home\\\\bin\\\\util\\\\cc_merge.bat" "%ccm_home" %{encoding[null='GB18030']} %outfile %file1 %ancestor %file2

About this task

ccm merge [[-create_task] | [-t|-task task_spec]]
          [-c|-comment comment_string]
          [-ce|-commentedit] [-cf|-commentfile file_path]
          file_spec1 file_spec2
-c|-comment comment
Specifies to add a comment on the new object containing the merged result. The comment can contain more than one line and accepts backslash encoded values.

You can use this option with -commentedit and -commentfile. If you use the -commentedit option, the comment displays in the default text editor.

-ce|-commentedit
Specifies to invoke the default text editor to compose and edit the comment. The result saved from the text editor is used as the final comment. You can use this option with the -comment and -commentfile options.
-cf|-commentfile file_path
Specifies to use the contents of the specified file for the comment. If you specified -comment, it is appended to that comment. You can use this option with the -commentedit option.
-create_task
Causes a task to be created automatically when Rational Synergy creates the new, merged object version, and associates the new object version with that task.

The task is assigned to the user who performed the merge. The release value of a task is set to the release value of the project in which the new object version is created. If the object version is created outside of a project, the release value is not set.

file_spec1
file_spec1 specifies the first file or directory to be merged. This is used for determining the default next version for the merged object. You can set file_spec1 to be a File specification for one file or directory.
file_spec2
file_spec2 specifies the second file or directory to be merged. You can set file_spec2 to be a File specification for one file or directory. If file_spec1 is a file, then file_spec2 must also be a file. If file_spec1 is a directory, then file_spec2 must also be a directory.
-t|-task task_spec
Specifies the task to associate the new merged version with. If you do not specify -task but you have set a current task, the current task is used by default. See Task specification for further details.

Feedback