# 5.8. Shelve

The shelve tool can move changes between the working directory and shelf patches. If the MQ extension has been enabled, it can also move changes into and out of unapplied patches.

The shelve tool can be launched by the Workbench Repository –> Shelve menu option, by a toolbar button on working file viewers, or by thg shelve.

Note

We highly recommend setting the patch eol configuration to auto if you use the shelve tool with DOS eoln text files.

Shelve dialog

## 5.8.1. Features

The shelve tool has three toolbars. A right and left toolbar for the two side by side panels, and a central toolbar for refresh and creating a new shelf patch. The right and left toolbars are mirrors of each other, offering the same functionality in alternate directions.

The left toolbar has these actions:

> Delete selected chunks

>   Remove, or revert, all selected (toggled) chunks in the currently selected file.

> Move all files right

>   Move all changes in all files to the patch selected in the right pane.

> Move selected file right

>   Move all changes in the currently selected file to the patch selected in the right pane.

> Edit selected file

>   If the working directory is being browsed, this button edits the currently selected file. Else it edits the currently viewed patch file.

> Move selected chunks right

>   Move all selected (toggled) chunks to the patch selected in the right pane.

The central toolbar has two actions:

> Refresh

>   Refreshes the patch drop down lists and the working copy view

> New Shelf

>   Creates a new shelf file. You must enter a name, though a reasonable default is provided.

The right toolbar will move changes from the patch selected on the left side to the patch selected on the right side, or the working copy if it has been selected on the right.

## 5.8.2. Patch Panes

The right and the left patch panes are identical save for the working copy changes are only available on the left. Selectable chunks are only displayed if the file is text and is in a modified state. Added or removed files can be shelved but parts of the file cannot be individually selected.

The Clear button will empty the currently selected patch or revert the entire working copy. The Delete button will delete the currently selected shelf patch.

Note

The Delete button is not sensitive when an MQ patch is selected. MQ patches must be deleted via qdelete using the Workbench context menu or the Patch Queue widget.

When right clicking on a file in the file list, you will get a context menu of commands.

> Visual Diff

>   Open the selected file in your default visual diff tool. Only enabled for working copy files.

> Edit Local

>   Open the working copy version of the selected file.

> Revert to Revision

>   Revert all changes to the selected file. Only enabled for working copy files.

## 5.8.3. Trashcan

The shelve tool is very conservative with your source and patch files. Before it modifies any file it makes a backup under `.hg/Trashcan`. This trashcan can be emptied by running the purge dialog from the Workbench Repository –> Purge menu option.

## 5.8.4. From command line

The shelve tool can be started from command line:

    thg shelve

    aliases: unshelve

    shelve tool

    use "thg -v help shelve" to show global options