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: Specify a connection and Map the branch to the stream.

Back to top

AccuRev Connector page

Use the AccuRev Connector menu to:

  • Define the mapping between branches in your Git repositories and mount points in your AccuRev streams.
  • Implement AccuRev change packages. This procedure is described in Change packages.

AccuRev Server Connection

Server name:port The AccuRev Server and port where the stream to be mapped exists.
Username The <gc_user> account that is a member of the group that is set to ASSIGN_USER_PRIVILEGE.
Password The password for <gc_user>.

Associate Issues With Commit

Issue Tracking System If you are using AccuRev change packages, use this field to specify whether you are using kandoMaintain or a third-party product such as Rally as your issue tracking system.
Regular Expression If AccuRev uses an issue tracking system (either kandoMaintain, or a third-party system such as Rally), you can specify a regular expression here to enforce comment requirements for AccuRev change packages. Populating this field enables change package integration; leaving it blank disables it.

Branch Stream Mappings

Branch The branch that you want to map to an AccuRev stream.
AccuRev Depot The AccuRev depot containing the stream that the Git branch is mapped to.
AccuRev Stream The AccuRev stream to which the current branch is to be mapped.
Mount Point The directory in the mapped stream to which the branch is to be synchronized. Navigate to the mount point in the graphical tree and click it to populate the Mount Point field.
Initial Synchronization This determines in which direction the first mapping will occur. If you are importing an existing repo into AccuRev, select Commit Git content to AccuRev . If you are exporting the existing content of an AccuRev stream to a newly mapped repo, select Commit AccuRev content to Git.

Caution: 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.

Back to top

Specify a connection

This section describes how to specify the AccuRev connection while mapping branches to streams.

To specify a connection:

  1. Click the Administration button and then click the Repositories menu.
  2. Click the repository you want to associate with AccuRev.
  3. On the Repositories page, click AccuRev Connector menu.

    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 Server can be added via the Servers tab (see Add an AccuRev server).
    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 Basic architecture for more information.)
    Password Specify the password associated with the account specified in the previous field.
  4. Click Save to test the AccuRev Server connection.

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, Map a Git Branch to an AccuRev Stream. You can also take this opportunity to implement AccuRev change packages. This procedure is described in Change packages.

Back to top

Map 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 image.

  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. For details, see Best practice for keeping merges and promotes in sync.

  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.

Back to top

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 the following Troubleshooting section for pointers on addressing any errors.

At this point, your Git users can create clones of the repo (within the limitations of whatever security settings you define). See Working with clones. 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 to enable PRESERVE_TEMP_FILES and ACCUREV_COMMAND_LOG debug configuration settings, and retry, running AccuRev commands manually to debug. For details, see kandoMaintain Command Reference.

Back to top

Unmap a branch from a stream

Unmapping a Git branch simply removes the association between the Git branch and the AccuRev stream, which prevents any future synchronization between the two. Unmapping does not remove any content from either the branch or the stream.

  1. Log in to GitCentric.
  2. Click the Administration button. Select Repositories to display the Repositories page.
  3. Click the repository whose branch you want to unmap.
  4. On the Repositories page, click AccuRev Connector menu. For details, see AccuRev Connector page.)
  5. From the list of mapped branches, identify the one that you want to unmap, then click its checkbox and then click Delete.

Back to top