Placing Projects Under Version Control

Introduction

AccuRev Plug-In for IntelliJ IDEA provides access to AccuRev version control commands within IntelliJ IDEA . The commands executed by the Integration move data between a central source-code repository (a depot) and a personal AccuRev work area (a workspace). AccuRev can manage an IDE project’s files if (and only if) the project’s location on disk is within an AccuRev workspace. It doesn’t matter which is created first, the IDE project or the AccuRev workspace.

Also relevant is this aspect of AccuRev’s data architecture: AccuRev does not automatically version control every file within an AccuRev workspace. For example, version-controlling text-editor backup files would be a waste of resources. Files created in a workspace initially have (external) status. They become version-controlled elements when explicitly processed with the Add to AccuRev Depot command.

Before Placing Projects Under Version Control

Make sure that AccuRev depots and streams have been created and properly configured. These operations cannot be performed within IntelliJ IDEA.

Use Cases

Case 1: An IntelliJ IDEA project already exists and you want to make AccuRev its version control provider

Perform the procedure in the section Making AccuRev the Version Control Provider for an Existing IDE Project.

Case 2: Your sources are already under AccuRev version control and you want to use IntelliJ IDEA for development

If you have access to an AccuRev workspace containing the sources, perform the procedure in Creating a New IDE Project in a Workspace.

If you need to create a new AccuRev workspace containing the sources, perform the procedure in Creating a Workspace for Sources that are Already Under AccuRev Version Control.

Case 3: Your sources are located in an AccuRev workspace and an IntelliJ IDEA project exists for the sources

Click File > Open Project, navigate to the project file (.ipr), and click OK.

Making AccuRev the Default Version Control Provider for New IDE Projects

After you perform this procedure, AccuRev version control will be enabled automatically for any project created with the New Project command, as long as the specified project file location for the new project is within an existing AccuRev workspace.
  1. Close any open projects.
  2. Click File > Settings from the IntelliJ IDEA main menu.
  3. Expand the Version Control node.
  4. In the Version Control list, select AccuRev.

Making AccuRev the Version Control Provider for an Existing IDE Project

You might want to use AccuRev selectively, for some new projects but not others. Or you might have existing projects to be used with AccuRev. This procedure handles both of these cases:

  1. Arrange for the project files to be located within an existing AccuRev workspace, in either of these ways:
    • Move all the project files from their current location to a location within an existing AccuRev workspace.
    • Use the AccuRev GUI to convert the project’s current disk location, or a higher-level directory, into a new AccuRev workspace (File > New > Workspace command).

    In either case, the project’s root directory need not be the top-level directory of the workspace.

  2. Open the project in IntelliJ IDEA .
  3. Click File > Settings from the IntelliJ IDEA main menu.

  4. Expand the Version Control node.

  5. In the Version Control list, select AccuRev.

  6. If you moved data into an existing workspace or created a new workspace, as outlined in Step 1, you must place the project’s files under version control. See Converting external-Status Files to Version-Controlled Elements.

Creating a Workspace for Sources that are Already Under AccuRev Version Control

Use this procedure if someone has already placed a set of development files under AccuRev version control on his or her own machine. This procedure creates a new workspace for your personal use, and updates the new workspace with the latest versions of the development files.
  1. Click Version Control > Checkout from Version Control > AccuRev or select Checkout from Version Control > AccuRev from the IntelliJ IDEA Quick Start menu. If you are using the accurev_login authentication mode, you might be required to log in at this time.
  2. On the Checkout From Version Control screen, specify an AccuRev depot, a stream within that depot, and a name for the new workspace. AccuRev automatically adds your username as a suffix to the name you enter (unless you type the suffix yourself). Click Next.
  3. On the Workspace Properties screen, accepting the defaults is often most appropriate. See the description of the Anchor command for a discussion of the exclusive file locking and anchor required features. Click Next.
  4. On the Workspace Directory screen, click the Browse button and navigate to an existing directory.
    The new workspace will be created as a subdirectory at the location you specify. The subdirectory name is the same as the workspace name you specified on the first wizard screen.
  5. IntelliJ IDEA automatically proceeds to create an IDE project in the new AccuRev workspace:

  6. Click Yes to complete the process.

Creating a New IDE Project in a Workspace

This is essentially the standard IntelliJ IDEA procedure for creating a new project, with a little extra work at the end.

  1. Choose Create New Project from the Quick Start menu, or click File > New Project on the IDE’s main menu.
    The New Project dialog box appears.
  2. Enter a Project name, and specify a Project location that is within an existing AccuRev workspace. You can create the project in the workspace’s top-level directory, or in a subdirectory.
  3. Continue through the wizard’s screens, ending with Finish.
  4. Make sure that AccuRev is the version control provider for the new project. See .
  5. Make sure that the files in the project are version-controlled elements. See .

Converting (external) Status Files to Version-Controlled Elements

AccuRev does not automatically version-control every file within an AccuRev workspace. For example, version-controlling text-editor backup files would be a waste of resources. Initially, files created in, or copied into, a workspace have (external) status. You can convert such files to version-controlled elements with the Integration’s Add to AccuRev Depot command. Use the following procedure when you’ve copied a set of files into a workspace (or, perhaps, unpacked a ZIP archive containing development data).
  1. Click AccuRev > Searches > External to list the workspace’s external files at the bottom of the IDE window.

  2. Select the (external)-status files that you want to convert to version-controlled elements.

    Tip: You may want to click Edit > Select All.

  3. Click Add to AccuRev Depot.

    The newly created elements have (kept) status.