1

On clearcase machine, Let say i have a file called xyz.c. I have checked out the file using command

jco -nc xyz.c  

now i did some changes and checked-in the file(not submitted yet) using below command

jci -nc xyz.c

I have now a new version created for the file xyz.c, which we can see by below command

jlog xyz.c
---------------------------------------------------------------------------
Date: 04-May-11.13:05:02 User: abc
Event: create version
Version: xyz.c@@/main/1
Comment:

---------------------------------------------------------------------------
Date: 28-Apr-11.12:19:51 User: abc
Event: create version
Version: xyz.c@@/main/0
Comment:

---------------------------------------------------------------------------
Date: 28-Apr-11.12:19:51 User: abc
Event: create branch
Version: io.c
Comment:

---------------------------------------------------------------------------

Let say i have again checked out for my coding purpose and checked in again which created version 2.

My question is : if i am on version 2, How can i delete the version 2 so that i can get my version 1. Note : version 2 is checked in but not submitted yet.

Goldi
  • 41
  • 1
  • 5
  • 1
    note, there is no notion of "submitted" with ClearCase: once checked-in, it is in fact registered in the central Vob. – VonC May 10 '11 at 07:53

4 Answers4

1

If you have checked in version 2 and:

  • don't have set any label on it
  • don't have create new other version on it

you could do a cleartool rmver xyz.c@@/main/2, but that is quite dangerous and not recommended.

A revert (as I wrote here) would be:

cleartool merge -graphical -to xyz.c -delete -version \main\2

Another (less complex) option would be to hijacking the content of xyz.c with version 1, that is just replace the local copy (you would need then to checkout and checkin in order to create a version 3.
See SO answer on cleartool get:

cleartool get –to xyz.c xyz.c@@\main\2
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

Your question is not very clear in terms, whether you have already checked in version 2 or not. In case you have not checked in version 2, you have to uncheckout the file. If you have checked in the file, you will need a rollback

Community
  • 1
  • 1
Ozair Kafray
  • 13,351
  • 8
  • 59
  • 84
  • HI, my version 2 is checked in, but not submitted. Could you let me know the command for rollback – Goldi May 10 '11 at 07:15
0

My question is : if i am on version 2, How can i delete the version 2 so that i can get my version 1.

I do not think you do not have to delete it as such, my interpretation is that you just want to see the older version 1 at some point after version 2 is created, is that right?

All versions of the content of the file (e.g. versions /main/0, /main/1 and /main/2) are stored in the VOB. However, when you work with clearcase you are not accessing the VOB directly, you are working with a view and all file access goes through the view server. The config specification will determine what versions of a file your view will select.

So if you specifically want to see version 1 of the file you can add

element xyz.c /main/1

to the config_spec before the rule that would otherwise select a version (use cleartool ls -l to check).


Also I notice you use commands jco, jci and jlog which is not the same as the standard clearcase commands cleartool co, cleartool ci and cleartool lshistory. So it seems like you are using some additional interface layer, there might be some issues with this.

hlovdal
  • 26,565
  • 10
  • 94
  • 165
  • "you just want to see the older version 1": that is why I suggested `cleartool get`, without having to modify the config spec (and don't forget your selection rule should be place "in front" of other rules if you want it do be taken into account) – VonC May 10 '11 at 13:41
0

You can also just bring up the version tree on the file graphically and right-click on the latest version and select delete.

Shari
  • 1