1

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?

Sneftel
  • 40,271
  • 12
  • 71
  • 104
raj
  • 343
  • 2
  • 15

1 Answers1

1

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thank you VonC. Yes, the clearcase will pop up while checking in the code. But what happens if more number of file checkout out from clearcase. The user may not aware of the latest versions checked in. – raj Mar 05 '13 at 12:19
  • I am thinking to write a batch file which should check all the checked out files and it's latest versions. Based on that user will know. This has to be done in a dynamic view. It will be helpful if you provide some suggestions. – raj Mar 05 '13 at 12:20