Shelve it, baby

#07 [from::the office]; the workspace or empty

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 shelve functionality in MercurialEclipse

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.

VN:F [1.9.17_1161]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.17_1161]
Rating: 0 (from 0 votes)

Verwandte Artikel:

  1. MercurialEclipse 1.3.1019 released
  2. MercurialEclipse 1.4.1280 released
  3. Bookmarks, a.k.a. local branches in MercurialEclipse