Goldi
Goldi

Reputation: 41

How to delete the specific version of a file from clearcase

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.

Upvotes: 1

Views: 6231

Answers (4)

Shari
Shari

Reputation: 1

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

Upvotes: 0

hlovdal
hlovdal

Reputation: 28180

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.

Upvotes: 0

VonC
VonC

Reputation: 1323573

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

Upvotes: 1

Ozair Kafray
Ozair Kafray

Reputation: 13539

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

Upvotes: 0

Related Questions