2. Using AccuRev® Features : Submitting AccuRev Elements to Code Review

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.
If this integration between AccuRev Web UI and Crucible has been implemented by your AccuRev system administrator, you can:
Tip: You can specify extensions for the files you wish to be treated as text files in Crucible. See Review Text File Extensions on page 49 for more information on this topic.
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.
Review Text File Extensions
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:
1.
Locate the raw-mime.types file in the directory where you installed Crucible.
2.
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
3.
4.
Save the raw-mime.types file.
5.
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 on page 55 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.
§
§
For more information on AccuRev Diff operations, see Diffing Files in AccuRev® on page 32.
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.
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:
1.
2.
3.
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 on page 51 for more information.
The Create Review dialog box appears:
4.
In the Name field, enter a name for the Crucible review.
5.
In the Project field, select the Crucible project in which you want to create the review from the drop-down list.
6.
Crucible opens in a new browser tab.
7.
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.
8.
9.
Start Review if you want to start the review immediately
Done if you want to start the review at another time
10.
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.
1.
2.
3.
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 on page 51 for more information.
The Add to Review dialog box appears:
Note: The Add to Review dialog box does not list closed reviews.
4.
5.
Click Add.
Crucible opens in a new browser tab.
6.
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.

Borland