IBM Support

Adding a new element type to the local cc.magic file

Question & Answer


Question

What are the steps required for creating a new element type and adding that type to a local IBM® Rational® ClearCase® magic file, on Microsoft® Windows®, UNIX® and Linux®?

Answer

This technote provides a walk through of the steps required for creating a new element type and adding it to a local ClearCase magic file named cc.magic.

Note: Review the ClearCase Command Reference Guide on the topic of cc.magic, default.magic (cleartool man cc.magic, default.magic) for details about the structure of .magic files. There are also other methods for managing magic files which are explained in technote 1122471 About the ClearCase Magic File.

The screenshots used in the below example are from Windows, however, the cleartool command line syntax can be found in the IBM Rational ClearCase Command Reference manual.

Review the ClearCase Command Reference Guide on the topic of mkeltype (cleartool man mkeltype) for more information regarding creating new element types.

Note: The GUI can only be used in non-replicated VOBs only; if ClearCase MultiSite® is enabled, then you will not be able to remove an element type or change the definition of an element type from the Type Explorer, and the command line syntax must be used.



Create a new element type (cleartool mkeltype)

For this example the new type is NEVER_MERGE, see technote 1123371 for details on how this type is used in the ClearCase UCM context:

  • Go to the Windows Start menu, traverse to Rational Software > Rational ClearCase > Type Explorer:



  • When it opens, you are prompted to select a VOB:



  • After selecting a VOB, click OK > double-click element types:



  • Right-click an empty space > select Create... > enter a name > click OK:



  • Element Properties dialogue will open > select Type manager tab > change the Merge type to Never consider elements of this type for merging:



  • If the VOB is replicated, then the following error will appear:




  • Otherwise, in a non-replicated VOB, the new element type will get created and be made available in the element type list:




Update the local cc.magic file with the new type

Note: The magic file is a first-fit tool, where:

  • the first lines match by name
  • the lines to the bottom match by content
    This means that a line that matches by name should be placed in the beginning of the file otherwise it may be ignored.
  1. This file, cc.magic, should be located in the config directory under the ClearCase installation. If it doesn't already exist, create cc.magic as a text file, by default the path is:
    • UNIX and Linux: /usr/atria/config/magic
    • Windows: C:\Program Files\Rational\ClearCase\config\magic

  2. Make a copy of the cc.magic file to another directory as a backup;
    for example, C:\Program Files\Rational\ClearCase\config\magic\backup\cc.magic
  3. Open the cc.magic file using Notepad (or another platform specific editor)

  4. An entry must be added for the new type, NEVER_MERGE

  5. There are plenty of entries for binary and compressed_file, so the new element type can most likely be based off an existing entry.

    Example:

    visio_template visio compressed_file : !-printable & -name "*.[vV][sS][tT]" ;
  6. To replace an existing entry, just add a '#' to the beginning of the line and add the new entry below it.

    Example 1
    Replacing an existing entry:

    existing entry --->
    # visio_template visio compressed_file : !-printable & -name "*.[vV][sS][tT]" ;

    new entry ---->
    visio_template visio NEVER_MERGE compressed_file : !-printable & -name "*.[vV][sS][tT]" ;

    Note: This entry, visio_template, may be located in different sections of the magic file, be sure to search for the entries and make the change under each section.

    Example 2
    Adding a new entry based on a different file extension that is not currently listed in the magic file:

    new entry ---->
    mht NEVER_MERGE compressed_file : !-printable & -name "*.[mM][hH][tT]" ;
  7. Repeat the above steps for all types that you want to be associated with the NEVER_MERGE element type, then Save and Close the magic file

  8. To confirm the change worked as expected, use cleartool file <filename>. The output will display what file type a visio file will be added as under source control in ClearCase.

    Example:

    Y:\material>cleartool file test.vst
    test.vst: NEVER_MERGE

[{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Magic File","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF015","label":"IRIX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"7.0;7.0.1;7.1;7.1.1;7.1.2;8.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
29 September 2018

UID

swg21146356