# Merging and Promoting Using the Merge Quest Tool

The Perforce Merge Quest tool enables you to graph the structure of your Perforce server by defining a hierarchy that you can use to propagate change between codelines. There are no restrictions on the number of connections a codeline can have or the types of codelines that can be connected. You control the display of codelines by manually arranging and connecting them on the canvas. After you define a hierarchy, you can export it as an XML file that other users can import and use.

To display the Merge Quest view, context-click the desired server connection in the P4 Connections view and choose Open Merge Quest.

## Creating the Diagram

To define a branching hierarchy, first define the codelines:

1. Drag a codeline icon from the palette to the Merge Quest canvas. P4Eclipse displays the New Codeline dialog.
2. Enter a descriptive name for your codeline and click Finish. The canvas displays an icon for the codeline.

Then, define the relationships:

To define the relationship between two codelines, you define connections that specify how changes are propagated:

- "To" connections specify the files and folders that accept changes from the codeline (target).
- "From" connections specify the files and folders that contribute change to the codeline (source).

You can connect files using the following methods:

- Add Branch Spec Connector: Use a Perforce branch specification. Browse to an existing one or create one by clicking .
- Add Depot Path Connector: Specify the depot path for the source or target files and folders. If a target path doesn't exist in the depot, it is created the first time you use the connection to integrate files to the target.

Alternately, you can click one of the codeline connectors in the palette (Branch Spec or Depot Path), then drag a line from one codeline icon to another.

To define the connections:

1. Context-click the desired codeline and choose the method for specifying the connection (branch spec or depot path). P4Eclipse displays a dialog that enables you to specify the source or target using a path or branch specification.
2. Specify the source or target path. (You can specify a source or target that doesn't exist — Merge Quest will create it.)
3. To restrict the follow of change to a single direction, click the corresponding arrow in the separator between the Source and Target lists. By default, change can be propagated in either direction.
4. To save your changes, click Finish.

## Merging and Promoting

To propagate change from one codeline to another:

1. Context-click the source or target codeline and choose Integrate To... or Integrate From... (or context-click the connector between the source and target and choose the desired integration. Connectors look like this: ). P4Eclipse displays the Integrate dialog.
2. Specify the desired options. For details about Perforce integration options, see the Perforce Command Reference (p4 integrate command description). P4Eclipse opens the source files for integration to the target in a pending changelist.
3. If necessary, resolve the files to select the revisions that you want integrates to the target codeline.
4. Submit the changelist containing the resolved files.

## Exporting and Importing Merge Quest Diagrams

You can export Merge Quest diagrams as XML files, which you can (manually) store on a file system, Web site or in a Perforce depot. Other users can import your files to obtain your diagrams.

To export a diagram, click and specify the location where you want to store it. To import a diagram, click and browse to the file or specify its location.

## Best Practices for Branching

For typical software development, Perforce recommends the mainline model. The mainline, where code is stabilized, resides above softer development codelines and below firmer release codelines. Code is expected to become increasingly stable as change flows from development to mainline to release.