How to rename/move a file or a directory in ClearCase?

IBM Rational ClearCase® is a fantabulous source code revision control software. Renaming an element in ClearCase VOB (Versioned Object Base) is quite simple.

  • Checkout the parent directory of the element which is supposed to be renamed.

cleartool co <parent-directory-of-the-element-to-be-renamed>

  • Issue the below command to rename the element:

cleartool mv <present-name-of-the-element> <new-name-of-the-element>

  • We did not checkout the actual element which is being renamed. This is because, renaming affects the directory listing the not the element itself.
  • Checkin the parent directory of the element.

cleartool ci <parent-directory-of-the-element>

Example: Consider a file named myFile to be renamed to yourFile located in a directory called sourcecode.

cleartool co sourcecode

cleartool mv sourcecode/myFile sourcecode/yourFile

cleartool ci sourcecode


Moving an element in ClearCase?

The cleartool mv command can also be used to move an element from one directory to another within the same VOB.

  • Checkout the parent directory the element to be moved.

cleartool co <parent-directory-of-the-element-to-be-moved>

  • Checkout the directory where the element is to be moved.

cleartool co <destination-directory-of-the-element>

  •   Issue the cleartool mv command to move the element.

cleartool mv <present-path-of-the-element> <new-path-of-the-element>

  •   An element can be moved as well as renamed with a single command as below.

cleartool mv <present-path-of-the-element> <new-path-of-the-element-with-new-name>

Example: Consider we have to move an element named oldFile from a directory called parentDirectory to newDirectory and also rename it as newFile.

cleartool co parentDirectory

cleartool co newDirectory

cleartool mv parentDirectory/oldFile newDirectory/newFile


What is a ClearCase VOB?

VOB is an acronym for Versioned Object Base. It is a repository within which ClearCase stores the elements that are under version control. To access the contents of these VOBs, IBM® uses a proprietary networked file system format named MVFS (MultiVersion File System)® for mounting the VOBs as a virtual file system.


Resources:

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.