2

I am trying to delete a file in ClearCase. When I attempt to delete it I get a message that the element has checkouts. When I do a version tree on the file I see that the file is checked out by another user, in another view, on a different branch.

How do I delete this file? In addition why doesn't ClearCase let me delete this file?

brainimus
  • 10,586
  • 12
  • 42
  • 64

1 Answers1

6

You can delete it through the command line and cleartool, by forcing its delete (option which isn't available with the GUI)

cleartool rmname -force theFile

Don't forget to checkout the parent directory first, then to checkin that same parent directory, in order for everyone to see that you have dereferenced that file within said directory.

See cleartool rmname:

–f/orce:

Forces the removal of the name when there is at least one checkout of the element.
When used with –nco, suppresses the prompt for confirmation.

That will work even when you had this before:

enter image description here

, as explained in the technote "About cleartool rmname and checkouts".

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Even I came across the same situation. I am wondering why in the first place, CC does not allow to delete a file which has checkouts on a completely different branch. – Mandar Jul 26 '13 at 08:21
  • @Mandar it is an old rule, aims at preventing a "casual" deletion without realizing that someone else is still working on it. You can bypass it in command-line only. – VonC Jul 26 '13 at 08:34
  • I am trying to make sure I understand it completely. Does a file deletion on one branch affects the same file on another branch? If not, why would I want to know if someone else is working on it on some other branch which will remain untouched even after my deletion. If yes, aren't the branches meant to provide development freedom (add/delete/edit files) to two developers working on two independent features? Or "deletion" is an exception to that freedom? – Mandar Jul 26 '13 at 09:05
  • Also, does a file deletion affects its version on main branch? – Mandar Jul 26 '13 at 09:06
  • @Mandar a rmname is a simple unreference of an element in the current branch (as explained in http://stackoverflow.com/a/8717755/6309). It has no effect on other branches. This warning only make sense **for future merges**. You need to be aware that merging your branch and another branch (where the file was in checkout and being modified) will get you an automatic conflict (ClearCase asking you whether or not you should keep that file, depending on the two versions of the parent directory being merge). – VonC Jul 26 '13 at 09:17
  • @Mandar so again, sure, you can `rmname` a file without worrying about other branches. But that warning is there to remind you that this file is currently worked on somewhere else. – VonC Jul 26 '13 at 09:18
  • That makes a lot of sense. Thanks @VonC! – Mandar Jul 26 '13 at 10:25