Shelve it, baby
As a some people seem to miss a shelve / unshelve feature in Mercurial, we now have a self-grown solution that works a lot like the hgshelve extension. It does the following:
- Check if we have not already shelved something for this project. If the shelf is not empty, we notify the user and abort.
- Determine which project files are in one of the states modified, added, removed or deleted. If the repository root is hierarchically above the project level, only the files within the current project are considered.
- Export a diff for all of these files to the file <project-name>-patchfile.patch that resides in the folder .hg/mercurialeclipse-shelve-backup. This patch file contains the diffs for all modified files in the project.
- Determine the changeset at which the current working directory is via hg id.
- Update to that changeset with hg update -C -r <changeset>.
- Refresh the resources whose diff was exported.
For Unshelving these changes we do the following:
- Check if there are files in our backup directory that contain shelved changes. Notify user and abort if no changes are shelved.
- Import changes via hg import <patchfile>.
- Empty shelve by deleting the patch file.
- Refresh the project directory for updating files and decorations within Eclipse.
The mandatory screenshot:
The current implementation is not compatible with the hg shelve extension, but this extension a) currently does not work and b) is only using interactive mode.
Verwandte Artikel:
![#07 [from::the office]; the workspace or empty](http://farm3.static.flickr.com/2311/2303858967_be0707026e_m.jpg)

