Importing and exporting repositories

This topic describes how to import a Git repository, and provides troubleshooting techniques for import/export operations.

Import an existing Git repository

If you have an existing Git repository that you would like to register with GitCentric and import into AccuRev, you can import a snapshot of the current state of the repository into AccuRev.

AccuRev Depots

You must import a Git repository into a case-sensitive AccuRev depot, unless you are 100% certain that repo is case-insensitive.

Your Git repo will be case-sensitive if it has been created and developed exclusively in a Linux/UNIX environment. If it has included any development from Windows or OS X developers, there is a good chance (but not 100% certainty) that the repo is case-insensitive, even if the repo itself is hosted on a Linux/UNIX server. If you attempt to map a case-sensitive repo to a case-insensitive depot, you will encounter errors, either at import time, or further down the road.

By default, AccuRev depots are case-insensitive, and the depot that is created during a new AccuRev installation is always case-insensitive. If you need a case-sensitive AccuRev depot for use with GitCentric, you (or an AccuRev administrator) must create one using AccuRev depot GUI features shown in the following illustration. See the AccuRev documentation for more information, or for the equivalent CLI commands to perform the same operation.

Back to top

Troubleshooting exporting AccuRev to Git

If you encounter an issue with syncing between a Git repository and AccuRev, check the following.

  • Check the triggers.log and ensure that the trigger has fired.
  • Check the KandoBridge.log and ensure that the trigger is reaching the bridge.
  • Test as described in the GitCentric Installation and Release Notes to check for missing dependencies.
  • Check that all necessary processes are running: postgres, tomcat, accurev_server.
  • Retry by “tickling” the stream:
    accurev chstream –E t -s <stream>

Back to top

Troubleshooting importing Git to AccuRev

If you encounter an issue with syncing between a Git repository and AccuRev, check the following.

  • Check for any Git push error messages.
  • f you receive the following error, particularly when first mapping an existing Git repository to an AccuRev stream, you may be trying to map a case-sensitive Git repo to a case-insensitive AccuRev depot::
    Import: com.accurev.gemini.commonapi.AHCommonAPIException Element already exists

    See Import an existing Git repository for more information.

  • If you are using Gerrit Code Review, make sure that the change is submitted (marked as review passed) after push.
  • If you are using Gerrit Code Review and the change state is merge failed then the import failed. Import errors (which are usually push errors) appear in the Comments table at the bottom of the Gerrit Code Review Change page.
  • Check the kandoGerrit.log and ensure that the bridge is being called.
  • Check the kandoBridge.log and ensure that hooks are reaching the bridge.
  • Check that all processes are running: postgres, tomcat, accurev_server.
  • Check the AccuRev acserver.cnf configuration file and ensure that the service account group (typically scm_bridge_group) is set as the value for ASSIGN_USER_PRIVILEGE, and that the group includes the actual user account (typically gcSyncUser) as a member, and that this user account is the one that was specified when the branch was mapped to the AccuRev stream. Note that some installations may use CC_USER rather than ASSIGN_USER_PRIVILEGE.)
  • Retry by redoing the push.

Back to top

Importing a snapshot of the repository

This section describes how to import a snapshot of the latest heads into AccuRev.

If you do not care about capturing the repo history, the process can be as simple as making a copy of the repository under the GitCentric repo storage directory. The next time you restart the GitCentric server, the repo will be visible through the GitCentric GUI.

To import a repository and just capture its current state:

  1. Create a copy of the repo in your GitCentric repository home.
    cd <gc_repo_home> (For example, /home/<gc_installer>/AccuRevGitCentric/site/git)
    cp -r <orig_repo>/<new_repo_name>
  2. Restart the GitCentric server. You have two options to accomplish this:
    1. Stopping and restarting the Tomcat web server:
      cd <ac_home>/WebUI/tomcat/bin

      Note: Make sure that the user starting Tomcat web server has write access to the logs, temp, webapps, and work directories in <ac_home>/WebUI/tomcat. This user should have read access to all other Tomcat web server directories and files.

    2. Flush the cache with an SSH command (entered on a single line):
      ssh -p 29418 <username>@<gc_server> gerrit flush-caches --cache projects --cache project_list
  3. Configure the repository through GitCentric and allow users to clone it as necessary as described in the other sections of this chapter.

Back to top