Under the hood: What happens when you add to source control
The mkelem or Add to source control command can be used to add file system objects to source control.
Using the Windows® graphical user interface
The Add to Source Control 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 options in the Add to Source Control window determine optional HCL VersionVault behavior:
- Selecting Checkout after adding to source control checks out the element. Any view-private data that corresponds to the element path remains in your view only and is added to version 1 in the VOB when you check in.
- Clearing Checkout after adding to source control checks in the element, using any existing view-private data that corresponds to the element path as the content for version 1. Your view config spec determines the branch on which version 1 is created.
- Selecting Preserve file modification time does not alter the date and time that the file was last modified.
- Clearing Preserve file modification time changes the modified time on the file to the checkin time.
- (Replicated VOBs only) Selecting Make current
replica the master of all newly created branches (file elements
only) assigns to your current replica mastership of all branches created
during element creation. You can create new versions on the branches.
Clearing this check box assigns mastership of a new branch to the VOB replica that masters the associated branch type. If this replica is not your current replica, you cannot create new versions on the branch.
Using the command line interface
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 HCL VersionVault behavior:
- Using mkelem with no arguments checks out the element. Any view-private data that corresponds to the element path remains in your view only and is added to version 1 in the VOB when you check in.
- Using mkelem -ci checks in the element, using any existing view-private data that corresponds to the element path as the content for version 1. Your view config spec determines the branch on which version 1 is created.
- Using mkelem -nco suppresses automatic checkout; mkelem creates the new element, along with the main branch and version /main/0, but does not check it out. If element-path exists, it is moved to a .keep file.
- (Replicated VOBs only) Using mkelem -master or mkdir -master assigns to your current replica mastership of all branches created during
element creation. You can create new versions on the branches.
Using mkelem or mkdir without the -master options assigns mastership of a new branch to the VOB replica that masters the associated branch type. If this replica is not your current replica, you cannot create new versions on the branch.
Other views do not see the element until the parent directories of the element are checked in (you must do this yourself) and you check in the file or directory.