This topic describes the GitCentric Code Review menu, which serves as a gateway to the third-party Gerrit Code Review tool and how to enable code review.
GitCentric has a code review capability. Some repositories have it enabled and others do not. Beginning with version 2017.1, the way to change and set code review enable has changed. The way to push and approve a code review, has not changed.
This video shows how to create a new repository with our without code review enabled, and how change the code review enable setting in an existing repository.
Overview of Gerrit code review
GitCentric incorporates the open source Gerrit Code Review tool, which provides web-based code review and project management for Git-based projects. GitCentric administrators can decide whether or not to require users to include code review in their workflow. Even if your site does not require you to perform code reviews, GitCentric uses Gerrit’s group-based ACLs and administration features.
To open the Code Review page, click the Code Review tab:
How this differs from the standalone
You access Gerrit Code Review from the Code Review tab in the GitCentric GUI. Log in and registration are handled through the GitCentric GUI.
If you are familiar with the standalone Gerrit Code Review, you may notice the following differences:
Top-level menu items take you to the GitCentric GUI:
|B||The Settings link takes you to the My Account menu in the GitCentric GUI.|
|C||The SHA of the GitCentric build you are using.|
|D||Use this link to contact customer support about an issue. Use the Report Bug link to contact Gerrit about issues with Gerrit Code Review.|
Otherwise, all other Gerrit Code Review functionality is handled through the Gerrit UI, and documentation for Gerrit features is handled by the Gerrit on-line help. For more information, refer to the Gerrit Code Review documentation.
Tip: Administration features are accessed from GitCentric, and not the Gerrit UI. (In GitCentric, the Administration menu takes you to Administrationpage in the GitCentric GUI. For details, see Administrator tasks.)
Code Review for users with different levels
This section compares code review for users with different levels of experience.
Experienced Git users
If you are a Git user who is new to both Gerrit and AccuRev, you will continue to use Git the same way you always have. However, if code review is enforced at your site, you may now need to configure your clones to push to a special code review branch. See Create a Clone From a GitCentric Repository. Your changes will need to be approved by others, and you may be requested to approve other people’s changes. In any case, once your changes are approved and pushed to the repository, GitCentric automatically synchronizes them with the appropriate stream in AccuRev. Likewise, when you do a pull, fetch, or clone, you may find that changes have been synchronized from the AccuRev stream.
Experienced AccuRev users
If you are an experienced AccuRev user, your site may have you continue to manage your changes in AccuRev SCM. If so, you may never need to log into GitCentric or use code review. But if you start working in Git, you will use GitCentric to access the code review features, and to manage your account.
Experienced Gerrit users
If you are an experienced Gerrit user, not much has changed: You push your updates in Git, and they get code-reviewed in Gerrit. If you are a reviewer, you will log in through GitCentric, and then go directly to Gerrit where you will perform Gerrit operations the same way you always have. However, your changes will now be automatically synced between the repository and the AccuRev stream to which it is mapped. (And if changes are made in the AccuRev stream, they will automatically be synced with the corresponding repository, and you will see them the next time you do a pull, fetch, or clone command.) The Settings link now goes to the GitCentric GUI, and administrators will find that all administrative functions now appear through the GitCentric GUI.
Regardless of your experience and your expertise, you should be aware that the four components that you may work with (Git, Gerrit, GitCentric, and AccuRev) each have their own documentation and knowledge base. Several excellent sites exist on the web for Git and Gerrit; and Gerrit, GitCentric, and AccuRev all have extensive on-line help. And you should have at least one experienced user or administrator at your site who is knowledgeable about each of these technologies.
Switching between Gerrit Code Review and GitCentric
GitCentric incorporates the open-source Gerrit Code Review tool. Your site may or may not have made code review mandatory. If it is mandatory, then when you push your changes in Git, they must be approved by other reviewers before they are accepted into the repository. You may be asked to be a reviewer for other people’s changes. If code review is not mandatory at your site, then when you push your changes, they go directly into the repository.
To use GitCentric’s optional Gerrit Code Review feature, click Code Review at the top of the GitCentric UI.
Doing so displays the Gerrit Code Review interface in the same browser window previously occupied by the GitCentric UI.
There are a number of ways to return to the GitCentric UI. In Code Review, click one of the following:
|Browser’s back button||The GitCentric page you were on prior to opening Gerrit Code Review.|
|Projects||The Repositories page (in GitCentric: Administration > Repositories).|
|People||The Groups page (in GitCentric: Administration > People).|
|Commits||The Commits page (in GitCentric: Commits tab)|
|username > Settings||The My Account page (in GitCentric: username > My Account).|
Gerrit Code Review has its own documentation, which you can find here: http://gerrit-documentation.googlecode.com/svn/Documentation/2.7/index.html.
Tip: Experienced users of Gerrit Code Review should note that all administrator and user profile functions are accessed through the GitCentric UI.
If you have difficulty submitting an approved change and cannot import it to AccuRev (as indicated by a Merge Pending or some other status), check the following:
- Look for error messages in the Change comments area.
Check the mappings. The mapping between Git repositories and AccuRev streams is generally transparent to Gerrit Code Review users, but you should be aware of the added meaning of the Merged status when a change has been approved: in a mapped GitCentric environment, merged not only indicates that the changes have been merged in the repository, but they have also been successfully imported to the AccuRev stream. If you cannot get to the Merged status, check for error messages on the Gerrit Code Review page and note any issues preventing the import.
- Have an administrator check that the following group ACLs are correct for the repository: Submit, Label Code Review, and Label Verified.
- Ensure that the commit parentage is up to date, and rebase if necessary.
- Examine the dependencies list for any changes that need to be submitted before the current change will merge.
- Check the kandoGerrit.log and kandoBridge.log files for errors.
Working with hooks
GitCentric supports both Git and Gerrit Code Review hooks. We recommend using Gerrit Code Review hooks when your environment requires hooks.
For more information about Gerrit Code Review hooks, see the Gerrit Code Review documentation.
Migrating existing Git hooks
Gerrit Code Review hooks,
ref-updated, are installed to
<gc_home>/site/hooks and are used to migrate any
Git hooks you might have created in the
ref-updated hooks require Perl and expect to find it at
/usr/bin/perl. If you have Perl in a different location, you will need to update these hooks with the correct path.