Map a Git Branch to an AccuRev Stream
You associate Git repositories and AccuRev depots at the branch and stream level, respectively: you map a specific branch in a Git repo to a “mount point” (a directory) within a specific AccuRev stream. This process has two main steps, each of which is performed on the AccuRev Connector panel in the GitCentric GUI:
1. Specify the AccuRev server connection.
2. Create the branch-stream mappings.
You also use the AccuRev Connector panel to implement AccuRev
change packages, which require that all changes be associated with a specific issue from your issue tracking system. See
Enable and Use Change Packages on page 43 for more information.
Avoid Git Reserved Name for AccuRev Elements
You should avoid using the Git reserved name ".git" for any element (a directory, file, or link, for example) in an AccuRev stream that is mapped to a Git repository. Using Git reserved words like ".git" for AccuRev elements creates problems when GitCentric synchronizes the stream and repository.
Specifying the AccuRev Server Connection
1. Click the
Administration button, then click the
Repositories menu to display the Repositories page. (See
Chapter 5 Administration for reference information.)
2. Click the repository you want to associate with AccuRev.
It is important that you specify the correct account here, so read carefully. The “Service Account” is the “robot” AccuRev user account that GitCentric uses to keep Git and AccuRev in sync. You may have different Service Accounts defined for different AccuRev servers and Git repositories that are under GitCentric control.
• Server name:port: Specify the host name (or IP address) of the AccuRev server that you wish to associate with this repository. If this is a new installation, and your GitCentric AccuRev server also functions as a regular AccuRev server, then you may have only one choice here. Other AccuRev servers can be added via the Servers tab (see
Add an AccuRev Server on page 46).
• Username: Specify the special AccuRev user that you defined during installation to perform GitCentric automated operations. This should be an account that is a member of the group that is assigned to the “ASSIGN_USER_PRIVILEGE” setting in the acserver.cnf file of the AccuRev server being mapped to this GitCentric branch. By convention, this account is often “gcSyncUser”, but it may be something different at your site.
(See the notes under
Basic Architecture on page 3 for more information.
) • Password: Specify the password associated with the account specified in the previous field.
4. Click the Save button to test the AccuRev server connection.
What to Do Next
Once you have created a valid AccuRev server connection, you can create your branch-stream mappings for the repository as described in the following section,
Mapping the Branch to the Stream.
You can also take this opportunity to implement AccuRev change packages. This procedure is described in
Enable and Use Change Packages on page 43.
Mapping the Branch to the Stream
Once you have specified the AccuRev server connection, you can map Git branches to AccuRev streams.
Note: You cannot map to the root stream of a depot.
1. In the
Branch-Stream Mappings section, click the
Add button.
GitCentric opens a panel beneath the table, as shown in the following illustration.
2. In each of the fields in this panel, you can click a Browse button to navigate to the value you wish to specify. Most fields are self-explanatory, but the Mount Point warrants additional discussion.
The
Mount Point is the directory within the stream that will synchronize AccuRev and Git content. GitCentric provides a display that allows you to navigate to the desired directory. You can select the root of the file system within this stream, or a subdirectory, which populates the field. The folder you select determines which AccuRev-controlled files will populate your repository.
Note: This step assumes that you have carefully planned out your branch-to-stream-mapping, and that you have either created a new stream or have identified an existing stream that is appropriate for mapping. See
Keeping Git Merges and AccuRev Promotes in Sync on page 5 for more information.
3. Specify in which direction the files should flow when the Git repository and the AccuRev stream are first mapped. If you are mapping a repo with content to a new stream, select Commit AccuRev content to Git. If you are mapping an existing stream with files to a new repository, select Commit Git content to AccuRev.
4. Repeat these steps for each branch and stream that you want to map.
5. When you are done, click
Save to save the branch-stream mapping. The next time you view the AccuRev stream, a "G" icon will be displayed for every stream that you have mapped to a GitCentric repo via the AccuRev Connector.
Test Your Mapping Status
When you save your mapping, GitCentric synchronizes the contents of the Git branch and the AccuRev stream by importing (branch-to-stream) and exporting (stream-to-branch) files as necessary. The status summary appears in the Status column of the Branch-Stream Mappings table. The status is updated every five seconds. When it displays Idle, the synchronization has completed.
To view details of this synchronization, including information about whether the import succeeded or failed, click the
View Details button to display the Status Monitor. See
Status Monitor on page 69 for more information. If the synchronization failed, see
Troubleshooting on page 42 for pointers on addressing any errors.
Create a Clone and Test It
At this point, your Git users can create clones of the repo (within the limitations of whatever security settings you define). See
Create a Clone From a GitCentric Repository on page 19. Whenever new content is pushed to the repo, it will automatically be reflected in the mapped AccuRev stream. On the AccuRev side, any content that is promoted into the mapped stream will automatically appear in the repository.
Troubleshooting
If the initial import/export operation failed after the mapping, check the following:
• Check Administration -> Repositories -> <repoName>-> AccuRev Connector/Branches for the status and the current branch SHA.
• Check the Status Monitor for import and export failure messages.
• Use the kandoMaintain command (see
Appendix A The kandoMaintain Utility) to enable PRESERVE_TEMP_FILES and ACCUREV_COMMAND_LOG debug configuration settings, and retry, running AccuRev commands manually to debug.