7.1 Adding Files and Directories to Source Control

You can add files or directories to source control (version control) at any time during the development cycle (see Elements, Components, and Baselines).

To Add Files and Directories to Source Control

You can add view-private files and directories to source control or make placeholders for nonexistent files and directories. Do the following:

  1. In your development view, set an activity (see Setting Your View to an Activity).

  2. Change to the parent directory under which you want to add files and directories to source control.

  3. For snapshot views, the path from which you add to source control does not need to be loaded. However, it must match the VOB namespace.

  4. Check out the parent directory element by entering this command:

  5. cleartool checkout -nc directory-name

    We suggest using the -nc option because Rational ClearCase appends appropriate comments when you modify directory elements.

  6. Do one of the following:

By default, when you add an element, it remains checked out. When you finish modifying the new elements, check them in. Elements that you add to a directory element are visible only in your view until you check in the directory.

For more information on the mkelem command, see Under the Hood: What Happens When You Add a File or Directory to Source Control and the mkelem reference page in the Command Reference.

Under the Hood: What Happens When You Add a File or Directory to Source Control

The mkelem command always creates an element and initializes its version tree by creating a single branch (named main) and a single, empty version (version 0) on that branch. The following arguments for the mkelem command determine optional ClearCase behavior:

Other views do not see the element until you check in the element's parent directories and check in the file or directory.

Figure 28 Creating an Element

Importing Files

If you're adding a large number of files and directories to source control, use the clearfsimport command (or clearexport command) and clearimport command. For more information, see the clearfsimport and clearimport reference pages in the Command Reference.