IBM Support

How to determine which element version a label was moved from

Question & Answer


Question

How can you determine which version an IBM Rational ClearCase label was applied to and moved from after using the mklabel -replace option to move a label?

Cause


When a label is moved from one version of an element, you may later want to move it back to that version as the development lifecycle of software goes through many phases.

Answer

The cleartool subcommand "lshistory" has an option to list history for minor events. This "-minor" option can be used to see label history. The label history will show the user who applied the label, to which version, and which version it was moved from.

It may be helpful to find any of the elements that have the label applied to them first using a cleartool find command. Once the versions are found a cleartool lshistory -minor command can be run on those versions. Piping the output may also cut down on the amount of data output.

Example:

  1. Find the versions with the label type applied to them:

    M:\view1\vob1>cleartool find . -version "lbtype(label1)" -print
    .\mvfslogs\20110321.log@@\main\1
    .\mvfslogs\20110329.log@@\main\2

  2. Look at the lshistory command output only for the moved labels for one of the elements:

    M:\view1\vob1\mvfslogs>cleartool lshistory -minor 20110329.log | findstr "Moved label "label1""
    --05-24T17:24 tcassid remove label "label1" from version "20110329.log@@\main\2"
    "Moved label "label1" to version "\main\4"."
    --05-24T17:24 tcassid make label "label1" on version "20110329.log@@\main\4" (label1)
    "Moved label "label1" from version "\main\2"."
    --05-24T17:15 tcassid make label "label1" on version "20110329.log@@\main\2"

  3. Combine the commands to find any instances of that label type that were moved to a different version:

    M:\view1\vob1\mvfslogs>cleartool find . -version "lbtype(label1)" -exec "cleartool lshistory -minor %CLEARCASE_PN%" | findstr "Moved label "label1""
    --05-24T17:16 tcassid make label "label1" on version ".\20110321.log@@\main\1" (label1)
    --05-24T17:24 tcassid remove label "label1" from version ".\20110329.log@@\main\2"
    "Moved label "label1" to version "\main\4"."
    --05-24T17:24 tcassid make label "label1" on version ".\20110329.log@@\main\4" (label1)
    "Moved label "label1" from version "\main\2"."
    --05-24T17:15 tcassid make label "label1" on version ".\20110329.log@@\main\2"


Note: The "grep" command can be used rather than "findstr" for a Unix or Linux system. Also, the %CLEARCASE_PN% variable is used on Windows systems while the $CLEARCASE_PN is used on Unix and Linux.

Refer to the ClearCase Information Center under the topics of lshistory or find for further details about these commands.

[{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Cleartool","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF022","label":"OS X"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"7.0.1;7.0.1.1;7.0.1.10;7.0.1.11;7.0.1.12;7.0.1.2;7.0.1.3;7.0.1.4;7.0.1.5;7.0.1.6;7.0.1.7;7.0.1.8;7.0.1.9;7.1;7.1.0.1;7.1.0.2;7.1.1;7.1.1.1;7.1.1.2;7.1.1.3;7.1.1.4;7.1.1.5;7.1.2;7.1.2.1;7.1.2.2","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
16 June 2018

UID

swg21500878