views:

1257

answers:

3

I have a file in my Clearcase repository. I checked it out and modified it, and then checked it back in.

I haven't done anything like make a baseline, or rebase, or deliver in my stream/view.

I regret having made the changes to this file--I should have undone the checkout, in retrospect.

How do I roll back the modifications? (Or undo, or revert, or whatever the correct nomenclature is.)

+1  A: 

Open version history for this file, then open in your editor a proper version of the file from the version tree, check out file once more, replace its with content of the previous correct version and check in. Don't forget to compare the previous version and the last version.

skwllsp
Is this the best that CC can do? Oy. (I'm new to CC, have used svn exclusively for past 5 yrs.)
JXG
I am not sure its the best but it gives a correct result :)
skwllsp
+3  A: 

What describes skwllsp can be be done in a dynamic view through the use of extended pathnames

cd m:/myDynamicView/MyVob/path/to/file
cleartool lsvtree myFile
cleartool checkout -c "cancel co" myFile
copy myFile@@/main/xx myFile
cleartool checkin -nc myFile

with xx being the version number you want to restore.


But should you have made multiple checkins, including some you want to cancel, ClearCase allows you to cancel part of the previous checkins through Subtractive Merge
See IBM "to remove contributions of some versions" (and merge man page)

You can remove all changes from a range of versions at once. For example, the following command removes revisions to versions 14 through 16 on the main branch:

  • On the UNIX system or Linux:
cleartool merge -graphical -to opt.c -delete -version /main/14 /main/16
  • On the Windows system:
cleartool merge -graphical -to opt.c -delete -version \main\14 \main\16

You can also remove the changes from one version at a time. For example, the following commands remove only the changes in version 14 from the version of opt.c checked out the current view:

  • On the UNIX system or Linux:
cleartool merge -graphical -to opt.c -delete -version /main/14
  • On Windows systems:
cleartool merge -graphical -to opt.c -delete -version \main\14

Alternatively, in any of the examples above, you can leave out the -version argument if you use the version extended path for the contributor-version-selector.


Finally, the one thing to not do is a rmver.
This command destroys information irretrievably and this is rarely a good thing.

VonC
A: 

Clearcase can do much better than just making a new version where you undo the change! Open the version history on your file, find the version you mistakenly checked in, and destroy it (select version to destroy and find the appropriate command under the Versions menu). This is what rmver does too, if you want to use the command line. As VonC said your this destroys your mistake irretrievably. I'm not seeing a downside to that.

Kathy
@Kathy: you are not seeing a downside, but that is a very *very* bad solution. The only one you shall never ever do. Even though is may work in this case, you are better off preventing your users to **ever do a rmver**. Ever. Because it works here means one day they will use it again in a situation where it will breaks all kind of thing. Seriously: do not do that.
VonC
FWIW, in my personal situation, I do not have permissions to delete files in this way.
JXG