Search code examples
clearcase

In ClearCase using commandprompt, how to check whether we have checkedout the latest version of the file?


I have a file called prog.c in clearcase, for example the user has checked out this file, say the user has checked out the version 3 of the file.

After that, if some other users checked in the same version of file. say the latest version be 6.

How to check the latest version of the file using the CLEARTOOL command?


Solution

  • One way would be a cleartool lsvtree yourFile:
    That would display a textual representation of the version tree, allowing you to see if the version you have is the LATEST on a given branch.

    But one nice trick I sometime use in snapshot view is: 'cleartool co -nc yourFile'.

    • if it works, I cleartool unco immediately.
    • but, if the version isn't the LATEST, the checkout will fail, with a warning asking to update first.

    Note that in a dynamic view, the problem is slightly different: one can checkout (unreserved) while other checkout/check-in.
    You will know you don't have the LATEST version on the checkin stage: it will complain you must merge with the actual latest version in order to create a "new latest" version which will the the result of the combination (merge) of your work and the later versions.


    One way to know where your at, with a checked out version, is to do a:

    cleartool descr -pred -fmt "%Sn" MyFile
    

    (see "Change set predecessor using cleartool", and "How to list all my check-ins using ClearCase?")

    "%Sn" will give you the branch and version of the file currently checked out.

    You can compare that with:

     cleartool descr -fmt "%Sn" M:\aDynamicView\Vob\path\to\myFile
    

    If you have a dynamic view with the same config spec and no checkouts, you can use it as "reference view", and see if the branch version in that reference view is the same than the version previous to the one checked out in your local (snap or dyn) view.