Search code examples
branchclearcase

How to I completely delete a branch for a specific file in clearcase?


I have a couple files that I want to work with on some branched but not others. For these files, the clearcase branching looks like this:

Dev ---> Dev/speical_branch_1
    ---> Dev/test_branch_1

I want to completely obliterate the test branch for both of these files so that the clearcase branching looks like this

Dev --> Dev/special_branch_1

How do I erase this branch from existence for only these files?

This is different from How to delete a clearcase branch with a single command? becasue I want to delete the branch for specific files. It is also different from Delete file from ClearCase checked out on another branch because I do not want to delete the files outright, but only remove certain branches from them.


Solution

  • That would be using cleartool rmver using a version-extended pathname, or a version selector (for base CC only, not UCM).

    The idea is to delete the extended path version of the file for that branch

    cleartool rmver -force -version \main\Dev\test_branch_1\1 myFile
    

    (use / on Unix, \ on Windows)

    Or, shorter: delete all versions between 1 and LATEST on the test_branch_1 branch of element myFile

    cleartool rmver -vrange  \main\Dev\test_branch_1\1  \main\Dev\test_branch_1\LATEST myFile
    

    That can be dangerous, especially in ClearCase UCM, where each version can have metadata (attributes) associated to it, which can break objects (like baselines).
    rmver is often blocked in that case.

    But in base ClearCase, if you have not set anything on those versions, and do not intend to use that branch for that file... that should work.

    I mentioned cleartool rmbranch -f file@@/main/aBranch 'seen in Brian's answer) as an alternative approach in "Command to delete branches of Clearcase element with “0” versions".