isakbob
isakbob

Reputation: 1539

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.

Upvotes: 1

Views: 1125

Answers (2)

VonC
VonC

Reputation: 1323553

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".

Upvotes: 1

Brian Cowan
Brian Cowan

Reputation: 1073

@VonC. That answer is not correct. You CANNOT remove the \0 version on a branch.

If you are removing an entire branch instance from a file, and this is NOT a UCM environment, you would use:

cleartool rmbranch myfile@@\main\branch

If it is a UCM environment, things get a little more challenging, and it's often best to leave them there and create a new stream.

Upvotes: 0

Related Questions