(Another) Mercurial Plugin for hoe


This is a fork of the [hoe-hg](bitbucket.org/mml/hoe-hg) plugin. I forked it because I use quite a few additional Mercurial tasks for my development workflow than are provided by the original, and I thought they'd possibly be useful to someone else.

I've offered to push my changes back up to the original, but I gave up waiting for a response.


# in your Rakefile Hoe.plugin :mercurial

If there isn't a '.hg' directory at the root of your project, it won't be activated.


$ rake hg:checkin


$ rake ci

This will offer to pull and merge from the default repo (if there is one), check for any unregistered files and offer to add/ignore/delete or temporarily skip them, run the :precheckin task (which you can use to run tests, lint, or whatever before checking in), builds a commit message file out of the diff that's being committed and invokes your editor on it, does the checkin, then offers to push back to the default repo.

Pre-Release Hook

This plugin also hooks Hoe's prerelease task to tag and (optionally) sign the rev being released, then push to the default repo. If there are any uncommitted files, it also verifies that you want to release with uncommitted changes, and ensures you've bumped the version number by checking for an existing tag with the same version.

If you also wish to check the History file to ensure that you have an entry for each release tag, add this to your hoespec:

self.check_history_on_release = true

You can also invoke or add the ':check_history' task as a dependency yourself if you wish to check it at other times.

It expects lines like:

== v1.3.0 <other stuff>

to be in your History file. Markdown, RDoc, and Textile headers are all supported.

To sign tagged revisions using 'hg sign', do this in your hoespec:

self.hg_sign_tags = true

This requires that 'hg sign' work on its own, of course.

Other Tasks

It also provides other tasks for pulling, updating, pushing, etc. These aren't very useful on their own, as it's usually just as easy to do the same thing yourself with 'hg', but they're intended to be used as dependencies in other tasks.

A 'rake -T' will show them all; they're all in the 'hg' namespace.


Hoe and Mercurial, obviously. I haven't tested these tasks with Mercurial versions earlier than 1.6 or so.


$ gem install hoe-mercurial


The original is used under the terms of the following license:

Copyright 2009 McClain Looney ([email protected]) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

My modifications are:

Copyright © 2010 Michael Granger <[email protected]>

and are licensed under the same terms as the original.