Using Support for Mercurial Queues in NetBeans IDE

The NetBeans IDE provides support for the Mercurial Queues extension. The IDE's Mercurial Queues support allows you to create, review or switch between patches within the IDE, as well as refresh patches with local modifications as you fix bugs or update to a new base revision. This document demonstrates how to perform basic patch-specific tasks in the IDE by guiding you through the standard workflow when using Mercurial versioning software for managing patches.

Contents

Content on this page applies to NetBeans IDE 7.4 and 8.0

Requirements

To complete this tutorial, you need the following software and resources.

Software or Resource Version Required
NetBeans IDE Version 7.4 or 8.0
Java Development Kit (JDK) Version 7 or 8
Mercurial client software 1.04 or higher

Note: Refer to the Using Mercurial Support in NetBeans IDE for information on how to install Mercurial client software on your system.

Enabling the Mercurial Queues Support

Since Mercurial Queues is an extension, you must explicitly enable it before you can use it.
To start running Mercurial Queues on your Mercurial repository, you need to complete the following steps:

  1. On your system , browse to the .hgrc file. The default location of the .hgrc file on OS X and Linux is $HOME/.hgrc, on Windows - %USERPROFILE%\Mercurial.ini.
  2. Add the lines below to your .hgrc file.
             [extensions]
             hgext.mq =
  3. Save the file.

top

Creating a Patch

To create a patch, you need to complete the following steps:

  1. In the Projects window, select a versioned project and choose Team > Queues > Create Patch (alternatively, right-click the project name and select Mercurial > Queues > Create Patch from the pop-up menu).
    The Create Patch dialog box displays.

    Create Patch dialog box

  2. Specify the name for a patch in the Patch Name text field.
  3. Provide the description of a patch in the Patch Message field.
    Alternatively, choose either of the following options and click OK afterwards:
    • click the Recent Messages button (Recent Messages) to select a message from a list of most recent commit messages
    • click the Load Template button (Load Template) to select a message template for a commit message.

    Note: The provided description of a patch will be used as a commit message when turning the patch into a permanent changeset.

  4. Select files to be included into the patch in the Files To Include In Patch table.
  5. (Optional) Specify information pertinent to an issue related to the created patch using the fields of the Update Issue area.
  6. Click Create Patch.
    A new patch is created and added to the .hg/patches directory.

top

Refreshing a Patch With Local Modifications

To save your progress into the patch you are creating , you need to complete the following steps:

  1. Choose Team > Queues > Refresh Patch from the main menu (alternatively, right-click the project name and select Mercurial > Queues > Refresh Patch from the pop-up menu).
    The Refresh Patch dialog box displays.

    Refresh Patch dialog box

  2. Provide the description of a patch in the Patch Message field.
    Alternatively, choose either of the following options and click OK afterwards:
    • click the Recent Messages button (Recent Messages) to select a message from a list of most recent commit messages
    • click the Load Template button (Load Template) to select a message template for a commit message.

    Note: The provided description of a patch will be used as a commit message when turning the patch into a permanent changeset.

  3. Select files to be included into the patch in the Files To Include In Patch table.
  4. (Optional) In the Update Issue area, specify information pertinent to an issue related to the changes being committed.
  5. Click Refresh Patch.
    The patch you are working on is updated.

top

Comparing Patch Revisions

To generate a patch for review and compare revisions of a patch side by side, you need to complete the following steps:

  1. Choose Team > Queues > Diff from the main menu (alternatively, right-click the project name and select Mercurial > Queues > Diff from the pop-up menu).
    The Diff Viewer displays differences found in the current patch and all your uncommitted/unrefreshed local changes in side-by-side panels:

    Diff Viewer

  2. Review and revise differences found in the compared files using either Graphical or Textual Diff Viewer.

    Note: The Graphical Diff Viewer highlights changes in the files using the following color encoding.

    Blue (       ) Indicates lines that have been changed since the earlier patch.
    Green (       ) Indicates lines that have been added since the earlier patch.
    Red (       ) Indicates lines that have been removed since the earlier patch.

    The following icons enable you to make changes directly within the Graphical Diff Viewer.

    Icon Name Function
    Replace icon Replace Inserts the highlighted text from the previous patch into the current patch.
    Replace all icon Replace All Reverts current version of a patch to the state of its selected previous version.
    Remove icon Remove Removes the highlighted text from the current version of a patch so that it mirrors the previous version of a patch.

top

Switching Between Patches

To switch to a particular patch in a patch queue series, you need to complete the following steps:

Note: To switch between patches there must be no local modifications in the working copy, otherwise the switch fails.

  1. Choose Team > Queues > Go To Patch from the main menu (alternatively, right-click the project name and select Mercurial > Queues > Go To Patch from the pop-up menu).
    The Go To Patch dialog box displays a list of all patches available in a stack.

    Go To Patch dialog box

    Notes:

    • Names of applied patches display in bold.
    • Choose Team > Queues > Pop All Patches to remove the applied patches from the top of the stack and update the working directory to undo the effects of the applied patches.
  2. Select the required patch and click Go.
    The IDE applies the changes contained in the selected patch to the chosen project, file, or folder.

top

Finishing Applied Patches

Once your work on a patch is done, it can be turned into a permanent changeset.
To turn all applied patches in a patch queue series into regular changesets, complete the following steps:

Note: To apply all saved patches in the repository, choose Team > Queues > Push All Patches from the main menu.

  1. Choose Team > Queues > Finish Patches from the main menu (alternatively, right-click the project name and select Mercurial > Queues > Finish Patches from the pop-up menu).
    The Finish Patches dialog box displays.

    Finish Patches

  2. Select the name of a patch to be finished in the patches field.

    Note: All patches in the series before the selected patch will also be finished.

  3. Click Finish Patches.
    The IDE turns all applied patches up to the selected patch into regular changesets.

top

Summary

This tutorial showed how to perform basic patch-specific tasks in the IDE by guiding you through the standard workflow when using Mercurial versioning software for managing patches. It demonstrated how to enable the Mercurial Queues support in the NetBeans IDE and perform basic tasks on patches while introducing you to some of the Mercurial specific features included in the IDE.

top


See Also

For related material see the following documents:

top

get support for the NetBeans

Support


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo