Submitting AccuRev Elements to Code Review
The AccuRev Web UI can be installed as an Atlassian Crucible (Crucible) code review system plug-in.
Note: The integration between the AccuRev Web UI and Crucible is only available for versions of Crucible prior to 3.0. If, however, you are using Crucible 3.0 or later, you can add AccuRev contents to a Crucible review by using the AccuRev Plug-In for Atlassian Crucible, which is available at the
http://www.accurev.com/customer-support-resources/downloads/integration-packages site.
Overview
If this integration between AccuRev Web UI and Crucible has been implemented by your AccuRev system administrator, you can:
-
Create a Crucible review for any text or binary file under AccuRev control. See Creating a Crucible Review for AccuRev Elements for more information.
Tip: You can specify extensions for the files you wish to be treated as text files in Crucible. See Review Text File Extensions for more information on this topic.
- Add files to an existing Crucible review. You can add different versions of the same file to an existing review over time to create an iterative review. See Submitting AccuRev Elements to Code Review Adding AccuRev Elements to an Existing Crucible Review for more information.
- Start the Crucible code review system from within the AccuRev Web UI. See Starting Crucible from within the Web UI for more information.
This section describes how to create and add to Crucible code reviews, and how to start Crucible from the Web UI. For more information about working with reviews in Crucible, see your Crucible documentation.
Before You Begin
This section describes factors to consider prior to submitting AccuRev elements to code review.
Crucible uses the text/plain attribute in the raw-mime.types file to identify the files in a code review that it can treat as text files. While Crucible recognizes many extensions commonly associated with text files (.txt and .cpp, for example), consider reviewing the raw-mime.types file to ensure that it includes any special files you plan on adding to code reviews. For example, you might want to include log files (.log) and configuration files (.cfg) in code reviews as text files. If so, you need to add these extensions to the text/plain attribute in the raw-mime.types file as described in the following procedure.
To specify text file extensions in Crucible:
- Locate the raw-mime.types file in the directory where you installed Crucible.
-
In the raw-mime.types file, locate the line that starts with text/plain. For example:
text/plain asc txt java jsp asp cs idl cpp cxx c h pl pod py sh
- Add the extensions you need to this list.
- Save the raw-mime.types file.
- Restart Crucible.
For more information, see your Crucible documentation.
Note: AccuRev determines whether files without an extension are text or binary when you add them to a review or include them in a new review.
Crucible User Account Requirements
Your Crucible administrator must create a Crucible user account using your AccuRev user identity before you can submit an AccuRev element to code review. See your Crucible administrator if you have trouble logging in to Crucible.
How Elements are Displayed in Crucible
When you submit an element to code review, AccuRev performs a diff operation to allow reviewers to compare versions of that element. As shown in the following illustration, versions used for the diff operation are displayed at the top of the Reviews tab, directly under the file name. Each version is displayed with its stream and version number -- in this example, 630/4 for the basis version and 630/5 for the head. Both versions display the AccuRev element ID (eid) -- in this example, 17726.
As in the AccuRev Diff tool, text is color-coded -- red to indicate text that has been removed from a version, green for text that has been added to a version. Sliders let you collapse the display to show only the contents of given version.
Tip: You can add the same element to an existing review multiple times, to create an iterative review. When you create an iterative review, each version you add is associated with its own entry, as shown in the following illustration:
See Adding AccuRev Elements to an Existing Crucible Review for more information about working with existing Crucible reviews.
Which Versions are Diffed
As described in the previous section, AccuRev uses a diff operation to provide versions of a given element to Crucible. In most cases, AccuRev determines which Diff Against operation to use based on the active view at the time you select the element for code review. For example, if you select an element from the Timeline Diff view, AccuRev diffs the versions at the start and end of the time period you specify. The following table summarizes the type of diff operation that AccuRev performs based on the current AccuRev view.
AccuRev View |
Type of Diff Performed |
Description |
---|---|---|
Timeline Diff |
Diff |
Automatically diffs versions of the selected element at the start and end of the specified time period. |
History Browser |
Diff Against Previous Transaction |
Automatically diffs the selected element against the version in the most recent transaction in which there was a content change. |
Issue Edit Form |
Diff Against Basis |
Automatically diffs the selected element against the basis version. |
Issue Diff View |
Diff Against Basis |
Automatically diffs the selected element against the basis version. |
File Diff View |
Diff |
Automatically diffs versions of the selected element in the selected streams. |
File Browser |
User chooses one of the following:
|
Allows you to choose which diff operation to use. See Use the File Browser to Choose the Diff Operation for more information. |
For more information on AccuRev Diff operations, see Diffing Files in AccuRev.
Use the File Browser to Choose the Diff Operation
Unlike other views in which AccuRev selects the type of diff operation to perform when submitting elements to code review, when you submit an element to code review from the File Browser you can choose whether you want to diff against backed, basis, or just your changes as described here:
- Backed Version: Compares your file with the version currently in the backing stream. For example, you might use this choice to see all the changes you have made to this file since you updated your workspace and starting working on the file. (And assuming no one else has promoted a new version to the backing stream in the meantime.) This might include the changes stored in several intermediate versions that you have created with keep.
- Basis Version: Compares your file with the version that you started working with, before making your "recent" changes.
- My Changes: Compares the workspace version with the common ancestor in the backing stream. This option is useful for files that have an (overlap) status because it identifies the changes in the workspace that did not come from the backing stream. The My Changes option is the equivalent of diffing against the last version that you merged with.
Choosing Files for Review
AccuRev lets you submit elements to code review both explicitly (as when selecting one or more elements from the File Browser, for example) or implicitly (as when selecting all the elements in a change package associated with an issue, for example.
Consider the Issue Edit form shown in the following illustration. In this example, the Changes subtab is active, and a number of files have been selected:
Notice the two Code Review buttons () highlighted in this particular view -- one on the Issue Edit form toolbar, another on the Changes subtab toolbar. AccuRev responds differently depending on which button you click:
- Clicking the Code Review button on the Issue Edit form toolbar submits to review all the elements associated with the current issue, regardless of whether or not you have selected any elements on the active subtab.
- Clicking the Code Review button on the Changes subtab toolbar submits to review only those elements that you explicitly select (server.h, stl_hash.h, and stream.h in the illustration, for example). Note that you can use Ctrl+ click and Shift+ click to select multiple elements.
The following table summarizes whether an AccuRev view allows you to select elements implicitly, explicitly, or both.
AccuRev View | Available Element Selection |
---|---|
Timeline Diff | Explicit |
History Browser |
|
Issue Edit Form |
|
Issue Diff View |
|
File Diff View | Explicit |
File Browser | Explicit |
Note: Multiple elements, regardless of whether you select them explicitly or implicitly, are always placed in the same Crucible review.
Creating a Crucible Review for AccuRev Elements
Use this procedure to create a new Crucible review for one or more elements under AccuRev control:
- In AccuRev, navigate to the browser or tab that manages the elements for which you want to create a Crucible review.
- Select the elements for which you want to create a Crucible review. See Choosing Files for Review if you need help with this step.
-
Click the Code Review button () and choose Create Review from the drop-down menu.
Note: If you are working in the File Browser, choose either Basis, Backed, or My Changes from the Create Review menu, as appropriate. See Use the File Browser to Choose the Diff Operation for more information.
The Create Review dialog box appears:
- In the Name field, enter a name for the Crucible review.
- In the Project field, select the Crucible project in which you want to create the review from the drop-down list.
-
Click Ok.
Crucible opens in a new browser tab.
- If you are already logged in to Crucible, the Edit Review Details page appears. Go to Step 8.
- If you are not logged into Crucible, the Log in to Crucible page appears. Go to Step 7.
-
In the Log in to Crucible page, enter your AccuRev username and password and click Log in.
The Edit Review Details page appears. Go to Step 8.
Note: Your Crucible administrator must create a Crucible user account using your AccuRev user identity. See your Crucible administrator if you have trouble logging in to Crucible.
-
In the Edit Review page, optionally edit information about the review you are creating, including:
-
When you are finished describing the review, click:
- Start Review if you want to start the review immediately
- Done if you want to start the review at another time
- On the Reviews tab, click an element to compare versions.
Adding AccuRev Elements to an Existing Crucible Review
Use this procedure to add one or more elements to an existing Crucible review.
Tip: You can also use this procedure to add a different version of an element that has already been added to a review to create an iterative review of that element.
- In AccuRev, navigate to the browser or tab that manages the elements you want to add to an existing Crucible review.
- Select the elements you want to add to the Crucible review. See Choosing Files for Review if you need help with this step.
-
Click the Code Review button () and choose Add to Review from the drop-down menu.
Note: If you working in the File Browser, choose either Basis, Backed, or My Changes from the Add to Review menu, as appropriate. See Use the File Browser to Choose the Diff Operation for more information.
The Add to Review dialog box appears:
Note: The Add to Review dialog box does not list closed reviews.
- Select the Crucible review to which you want to add the elements.
-
Click Add.
Crucible opens in a new browser tab.
-
In the Log in to Crucible page, enter your AccuRev username and password and click Log in.
The Reviews tab appears, as shown in Step 5.
Note: Your Crucible administrator must create a Crucible user account using your AccuRev user identity. See your Crucible administrator if you have trouble logging in to Crucible.
Starting Crucible from within the Web UI
If your AccuRev system administrator has configured AccuRev as a Crucible plug-in, the Code Review button () appears in the Web UI toolbar, as shown in the following illustration.
To start Crucible from within AccuRev, click the Code Review button (). Crucible opens in a new Web browser instance, displaying the login page.
Once you have logged in to Crucible, you can set up reviews for files that are under AccuRev control. See your Crucible documentation for more information on creating reviews in Crucible.